【发布时间】:2018-05-01 19:56:55
【问题描述】:
我正在尝试在我的 Azure 应用程序上实现 SendGrid,但它一直在浏览器上抛出 HTTP ERROR 500。我正在使用完全相同的代码遵循本教程,但输入了我的值。我似乎找不到任何关于如何解决这个问题的信息,以及我可以判断这些值是正确的。错误发生在创建Swift_SmtpTransport::newInstance() 方法时。
这里是sn-p的代码:
$text = "Hi!\nHow are you?\n";
$html = "<html>
<head></head>
<body>
<p>Hi!<br>
How are you?<br>
</p>
</body>
</html>";
// This is your From email address
$from = array('someone@example.com' => 'Test User');
// Email recipients
$to = array(
'toemail@email.com' => 'Elite Email Address'
);
// Email subject
$subject = 'Example PHP Email';
// Login credentials
$username = 'myusernamefromazure';
$password = 'mypassword';
// Setup Swift mailer parameters
$transport = Swift_SmtpTransport::newInstance('smtp.sendgrid.net', 587); <-- this is where the error is thrown...
有人可以帮我解决这个问题吗?
【问题讨论】: