Use variable in laravel swift mail

no comments
7 Apr 2015 1:54 am

This is default simple documentation of #laravel to send mail but problems is that this is static mail passed in parameter to(‘’)

Mail::send('emailtemplate_view', ['data' => 'for_emailtemplate_view'], function($message){
	$message->to('', 'SDTuts')->subject('Welcome!'); });

We also need to pass the dynamic email, for example we used it for user registration steps to sent mail for activation it that time we need dynamic email address not static.
here is code example to use variable in laravel mail method.

$mail_sendinfo = array(
	'mail_subject'=>'User registration confirmation!',
	'user_name'=>'Rameez Soomro'

Mail::send('emailtemplate_view', ['data' => 'for_emailtemplate_view'], function($message) use($mail_sendinfo) {
	$message->to($mail_sendinfo['user_email'], $mail_sendinfo['user_name'])->subject($mail_sendinfo['mail_subject']);

NOTE:Your Email Address will be not shown and please do not add spamming comments because here is REL="NOFOLLOW" on your links and comments also moderated shown.
<code>Put html css or any language code under this tag</code>