created the mail queue functioanlity