search and mailer function