>我在Laravel中有这样的代码来发送电子邮件
public static function send_email(){
Mail::send('emails.g', array(), function($message){
$message->from('leo_messi@barcelona.com', 'lol');
$message->to('neymar@barcelona.com')->subject('LOL LOL');
});
}
我的电子邮件配置文件是这样的
return array(
'driver' => 'smtp',
'host' => '{host ip here}',
'port' => 25,
'from' => array('address' => null, 'name' => null),
// 'encryption' => 'ssl',
'username' => "leo_messi@barcelona.com",
'password' => "lollol",
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,
);
我可以使用上面的代码从我的Gmail帐户发送邮件。 但我想从本地 Exchange 服务器发送电子邮件(NTLM 身份验证)。 上面的代码不适用于Exchange服务器。我怎么了?
你需要使用 imap 或 pop3
,我只用 pop3 和 imap 做到了。但是,您可以将 MS 交换配置为允许使用用户名和密码进行这些协议。