标签:发送邮件 smt ESS com tran mes subject pre smtp
// 备份原有Mailer
$backup = Mail::getSwiftMailer();
// 设置邮箱账号
$transport = \Swift_SmtpTransport::newInstance('smtp.exmail.qq.com', 465, 'ssl');
$transport->setUsername('xxx@xxx.xxx');
$transport->setPassword('xxxxxx');
$mailer = new \Swift_Mailer($transport);
Mail::setSwiftMailer($mailer);
Mail::send('mail.template', array $data, function ($message) {
$message->from('xxx@xxx.xxx', 'xxxxxx');
$message->subject('邮件主题');
$message->to('receiver@xxx.xxx');
});
// 发送后还原
Mail::setSwiftMailer($backup);
标签:发送邮件 smt ESS com tran mes subject pre smtp
原文地址:https://www.cnblogs.com/my3306/p/9712499.html