added mailer algorithm