Skip to content

Instantly share code, notes, and snippets.

@alfredoem
Created December 9, 2015 21:38
Show Gist options
  • Save alfredoem/765d9c0923362442e2d4 to your computer and use it in GitHub Desktop.
Save alfredoem/765d9c0923362442e2d4 to your computer and use it in GitHub Desktop.
Send email in laravel 5
/*
* Email send function
*/
$nameTo = $request->FirstName . " " . $request->LastName;
$emailTo = $request->email;
$subject = 'Welcome to the jungle!';
try{
\Mail::send("emails.welcome", ['name' => $nameTo, 'email' => $emailTo], function($message) use ($nameTo, $emailTo, $subject){
$message
->to($emailTo, $nameTo)
->subject($subject);
});
}catch(Exception $e){
\Log::info($e->getMessage());
}
/*
* Email send view
*/
<html>
<head>
<title> ZitBox - Account Validated</title>
</head>
<body style="width:100%;">
<meta content="text/html; charset=utf-8" />
<div style='text-align: center;
width: 100%;
background: white;
padding: 0 auto;
margin: 0 auto;
font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
font-weight: 300;
font-size: 16px;'>
<table width="720px" style=" background-image: -webkit-radial-gradient(center, ellipse cover, rgb(63,63,63) 0%, rgb(39, 39, 39) 100%); margin: 0 auto;
border: 1px solid #BE202A;
padding-bottom: 2em;" cellspacing="0" border="0">
<tr height="95px" style="text-align: left;
background: #BE202A;
border-bottom: 1px solid #BE202A;">
<td width="40px"></td>
<td width="640px"><img src="{{url('/imgs/logo.png')}}" alt="Logo" title="" width="160"></td>
<td width="40px"></td>
</tr>
<tr height="30px"><td></td><td></td><td></td></tr>
<tr>
<td width="40px"></td>
<td width="640px" style="text-align: left;
background: white;
padding: 1em 1.5em;
line-height: 1.7em;
font-size: 0.9em;">
<h1>Gracias por Registrarse</h1>
<p style="margin: 20px 0 0 0;font-size:12px;">Hola {{ $name }}.</p>
<p style="margin: 5px 0;font-size:12px; line-height:16px;">Felicitaciones!. Tu registro fue satisfactorio.
Echa un vistazo a <a href="{{url('/')}}" target="_blank">{{url('/')}}</a> hemos creado tu cuenta
</p>
<hr style=" width: 80%;
background: rgb(151, 151, 151);
border: none;
height: 1px;"/>
</td>
<td width="40px"></td>
</tr>
<tr height="20px"><td></td><td style="text-align:center;font-size:12px;padding:15px 0 0 0;color: #fff">Este mensaje fue enviado a {{ $email }}por que esta inscrito al newlater.</td><td></td></tr>
</table>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment