Laravel4and Laravel5Messages are sent in exactly the same way. Laravel5The mail is sent in Chinese document in: http://Laravel-china.org/docs/5.0/mail
In this article, I will163The mailbox, for example, shows how to send a message using the Laravel built-in mail delivery class.
Configuration
Modify the Mail send configuration.4.2In app/config/mail.php,5In config/mail.php, modify the following configuration:
'Host'='smtp.163.com',
'Port'= -,
' from'= = Array ('Address'='***@163.com','name'='Testmail'),
'username'='***@163.com',//Note that this must be the same as the email address in the previous line of configuration
'Password'='****',
Send
In the controller or model, call the following code: $DATA = ['Email'= $email,'name'= $name,'UID'= $uid,'Activationcode'= $code];
Mail::send ('Activemail', $data, function ($message) use ($data)
{
$message->to ($data ['Email'], $data ['name'])->subject ('Welcome to register our website, please activate your account! ');
});
The message view is views/activemail.blade.php:
<!doctype html>
"ZH-CN">
<meta charset="UTF-8">
<meta http-equiv="x-ua-compatible"Content="Ie=edge">
<body>
<a href="{{{URL (' active?uid= '. $uid. ') &activationcode= '. $activationcode)}}"target="_blank"> Click to activate your account </a>
</body>
How to use SMTP to send mail in Laravel (for 163, QQ, Gmail, etc.)