error_reporting(E_ALL);
require_once 'swift_required.php';
//Create the Transport
$transport = Swift_SmtpTransport::newInstance('mail.your_domain.com', 25)
->setUsername('name@your_domain.com')
->setPassword('your_password')
;
//Create the Mailer using your created Transport
$mailer = Swift_Mailer::newInstance($transport);
//Create a message
$message = Swift_Message::newInstance('PHP Message')
->setFrom(array('name@your_domain.com'))
->setTo(array('name@your_domain.com'))
->setBody('PHP Swift Mailer sent with authentication')
;
//Send the message
$result = $mailer->send($message);
if (!$mailer->send($message, $failures)) {
echo "Failures:";
print_r($failures);
}
这是我用于发送电子邮件的代码。但它不能正常工作。甚至没有任何错误或失败消息。怎么了?