backported mailer functionality from Laravel 4