swiftmailer时没有设置https的选项,才可以发送成功。在linux下面

<?php
$su = 'register';
$ge = '1362836763@qq.com';
$co = 'Please register!';
send_mail($su,$ge,$co); function send_mail($subject,$getter,$content)
{
$https['ssl']['verify_peer'] = FALSE;
$https['ssl']['verify_peer_name'] = FALSE;
$result = false;
$sender = 'yourEmailName@163.com';
$transport = Swift_SmtpTransport::newInstance('smtp.163.com', 465,'ssl')
->setUsername($sender)
->setPassword('yourEmailPassword')
->setStreamOptions($https);
$mailer = Swift_Mailer::newInstance($transport);
$message = Swift_Message::newInstance($subject)
->setFrom(array($sender => 'Chinese Project'))
->setTo($getter)
->setBody($content)
;
$result = $mailer->send($message);
$success = $result ? 0 : 1;
return $result;
}
上一篇:VLAN,GRE,VXLAN


下一篇:vscode下运行matlab记录