Install using the Artian CLI:
php artisan bundle:install messages
Laravel配置bundles.php
application/bundles.php
return array(
'messages' => array('auto' => true),
);
配置
1,基于smtp发邮件
config the swiftmailer(messages)
bundles/messages/config/config.php
'default' => 'smtp',
'smtp' => array(
'host' => 'smtp.163.com',
'port' => 994,
'username' => 'XXXX@163.com',
'password' => '******',
'encryption' => 'ssl',
),
2,基于sendmail发邮件
'default' => 'sendmail',
transports 内配置
'sendmail' => array(
'command' => '/usr/sbin/sendmail -bs',
),
Message::to("XXXX@163.com")
->from($email,$name)
->subject($title)
->html(true)
->body($content)
->send();
if(Message::was_sent()){
$data['success'] = '信息发送成功!';
}