Skip to content

Instantly share code, notes, and snippets.

@tbergeron
Created March 21, 2014 20:36
Show Gist options
  • Save tbergeron/9695803 to your computer and use it in GitHub Desktop.
Save tbergeron/9695803 to your computer and use it in GitHub Desktop.
private function sendWelcomeEmail(User $user)
{
// Enabling pretend mode for developers
// Writing email in logs instead of really sending them.
if (App::environment('development')) {
Mail::pretend();
}
$data = [];
// transfering only the needed properties to the closure
// as queue has a 64kb limit: http://stackoverflow.com/a/21299503
$user_email = $user->email;
$user_fullname = $user->firstname . ' ' . $user->lastname;
Mail::queue('success_email', $data, function($message) use ($user_email, $user_fullname)
{
$message->to($user_email, $user_fullname);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment