swiftmailer Auth与hotmail有关

时间:2016-09-09 18:25:53

标签: php phpmailer swiftmailer

我搜索了高低,我似乎无法找到使用 hotmail smtp的swiftmailer脚本的工作示例,我尝试在示例中使用google one并在端口,用户和密码,但页面会挂起,直到超时。

我的代码:

  require_once 'lib/swift_required.php';
// Create the SMTP configuration
$transport = Swift_SmtpTransport::newInstance("smtp.live.com", 465, "TLS");
$transport->setUsername("xxxx@hotmail.com");
$transport->setPassword("XXXXXX");

// Create the message
$message = Swift_Message::newInstance();
$message->setTo(array(
   "XXXX@company.com" => "xxx",
));
$message->setCc(array("another@fake.com" => "Aurelio De Rosa"));
$message->setBcc(array("boss@bank.com" => "Bank Boss"));
$message->setSubject("This email is sent using Swift Mailer");
$message->setBody("You're our best client ever.");
$message->setFrom("XXXXX", "XX XXXXXXX");


// Send the email
$mailer = Swift_Mailer::newInstance($transport);
$mailer->send($message, $failedRecipients);

// Show failed recipients
print_r($failedRecipients);

1 个答案:

答案 0 :(得分:0)

我希望您需要正确设置加密参数。对于端口465,使用ssl; 587,tls。 hotmail与其他任何地方都没有任何不同 - 你的代码无法在任何地方使用。

相关问题