public function queue() { $data = ['name' => 'Ryan']; Mail::later(5, 'emails.queued_mail', $data, function ($message) { $message->to('*****@*****.**', 'Ryan Kang')->subject('Welcome! This is a queued mail'); }); return 'Email will be sent in 5 seconds'; }
public function sendNewsLetter($data, $name, $email, $title) { Mail::later(1, 'emails.newsletter', ['data' => $data], function ($message) use($name, $email, $title) { $message->from(\Cache::get('contactusInfo')->email, 'Newsletter - 7orof.com'); $message->subject('7orof.com | Newsletter | ' . $title); $message->priority('high'); $message->to($email); }); }
/** * Handle the event. * * @param SendRegisterationConfirmationEmail $event * @return void */ public function handle(SendRegisterationConfirmationEmail $event) { $user = $event->user; $email = $user->email; Mail::later(1, 'emails.confirm', ['data' => ['id' => $user->id]], function ($message) use($email) { $message->from(\Cache::get('contactusInfo')->email, ' | 7orof.com'); $message->subject('7orof.com | Email Confirmation'); $message->priority('high'); $message->to($email); }); }
protected function callQueue($template, array $values = [], $queueTime = null) { if (empty($queueTime)) { Mail::queue($template, $values, function ($message) { $this->sendClosure($message); }); return $this; } Mail::later($queueTime, $template, $values, function ($message) { $this->sendClosure($message); }); return $this; }
|-------------------------------------------------------------------------- | | Here is where you will register all of the routes in an application. | It's a breeze. Simply tell Laravel the URIs it should respond to | and give it the controller to call when that URI is requested. | */ use Illuminate\Support\Facades\Mail; Route::get('/', function () { return view('welcome'); }); Route::post('/search-results', function () { return sprintf('Search results For "%s"', Request::input('search')); }); /* |-------------------------------------------------------------------------- | Application Routes |-------------------------------------------------------------------------- | | This route group applies the "web" middleware group to every route | it contains. The "web" middleware group is defined in your HTTP | kernel and includes session state, CSRF protection, and more. | */ Route::get('mail/queue', function () { Mail::later(5, 'emails.queued_email', ['name' => 'sudip sarker'], function ($message) { $vari = rand(1, 100); $message->to('*****@*****.**', 'Sudip Kumar Sarker')->subject($vari); }); return 'Email will be sent in 5 secend .....'; });
|-------------------------------------------------------------------------- | Routes File |-------------------------------------------------------------------------- | | Here is where you will register all of the routes in an application. | It's a breeze. Simply tell Laravel the URIs it should respond to | and give it the controller to call when that URI is requested. | */ use Illuminate\Support\Facades\Mail; Route::get('/', function () { return view('welcome'); }); Route::get('mail/queue', function () { Mail::later(5, 'emails.queue', ["name" => "Rodolfo"], function ($message) { $message->to('*****@*****.**', 'Kevin Ventura')->subject('Sistema de Colas'); }); return 'Este email se enviara en 5 segundos'; }); /* |-------------------------------------------------------------------------- | Application Routes |-------------------------------------------------------------------------- | | This route group applies the "web" middleware group to every route | it contains. The "web" middleware group is defined in your HTTP | kernel and includes session state, CSRF protection, and more. | */ Route::group(['middleware' => ['web']], function () { //