每次我试图通过在symfony 2.3.11中使用迅捷邮件的google应用程序帐户发送电子邮件时,我都会收到以下消息
无法与主机smtp.gmail.com php_network_getaddresses建立连接: getaddrinfo失败:名称解析中的临时故障#0500内部服务器错误- Swift_TransportException
我搜索了它,但没有得到任何结果,所以我肯定做错了什么。
config.yml
# Swiftmailer Configuraftion swiftmailer:
transport: gmail
username: info@*******.com
password: **发送电子邮件的控制器:
/* send an email to user */
$message = \Swift_Message::newInstance()
->setSubject('Thank you')
->setFrom('info@********.com')
->setTo($email)
->setBody(
$this->renderView(
'xyProfileBundle:Mailer:thankyou.html.twig',
array('email' => $email, 'token' => $token)
)
)
->setContentType("text/html");
$this->get('mailer')->send($message);我怎么才能解决这个问题?
发布于 2014-04-03 08:17:32
看起来您的主机无法解析smtp.gmail.com。
试着打开它:
ping smtp.gmail.com和:
php -r 'var_dump(gethostbyname("smtp.gmail.com"));'发布于 2014-12-15 21:26:54
尝试使用IP地址74.125.206.109而不是域名(smtp.gmail.com)
https://stackoverflow.com/questions/22831341
复制相似问题