cakephp到gmail被阻止
我很难通过非Gmail帐户通过CakePHP 2 将电子邮件发送到Gmail帐户。 (编辑)
gmail的错误代码: 550-5.7.26此消息没有身份验证信息,或者
服务器中没有SPF记录,我可以使用Thunderbird(例如Thunderbird)将电子邮件发送到Gmail。
这是我的代码。
/app/config/email.php
class EmailConfig {
public $email = array(
'transport' => 'Smtp',
'host' => 'mail.example.com',
'port' => 587,
'timeout' => 30,
'username' => '[email protected]',
'password' => 'password',
'log' => false,
'returnPath' => '[email protected]',
);
}
进行了一些谷歌搜索后,我也尝试过。
class EmailConfig {
public $email = array(
'transport' => 'Smtp',
'host' => 'mail.example.com',
'port' => 587,
'timeout' => 30,
'username' => '[email protected]',
'password' => 'password',
'log' => false,
'SMTPSecure' => 'starttls',
'tls' => true,
'context'=>array('ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
控制器
$email = new CakeEmail('ap');
$email->charset = 'ISO-2022-JP';
$result = $email
->config(array('log' => 'emails'))
->to(array($this->request->data['Order']['mail']))
->bcc(array(Configure::read ('Mail.Bcc')))
->from(array(Configure::read ('Mail.FromMail')=> 'MyBusinessName'))
->subject($this->request->data['Order']['order_subject'])
->send($this->request->data['Order']['message']);
if (!$result) {
$this->Session->setFlash(__('MailSend Failed Retry Again '));
return;
} else {
$this->OrderMailHistory->commit();
$this->OrderStateHistory->commit();
$this->Order->commit();
$this->redirect(array('action' => 'detail/', $this->request->data['Order']['id']));
}
}
可以建议我们如何将电子邮件发送到Gmail? 非常感谢!
I'm having trouble sending emails to Gmail accounts through CakePHP 2 from a non-Gmail account. (EDIT)
Error code from Gmail:
550-5.7.26 This message does not have authentication information or fails to
SPF records are present in the server and I am able to send emails to Gmail using email software like Thunderbird.
Here is my code.
/app/Config/email.php
class EmailConfig {
public $email = array(
'transport' => 'Smtp',
'host' => 'mail.example.com',
'port' => 587,
'timeout' => 30,
'username' => '[email protected]',
'password' => 'password',
'log' => false,
'returnPath' => '[email protected]',
);
}
After some Googling, I tried this way as well.
class EmailConfig {
public $email = array(
'transport' => 'Smtp',
'host' => 'mail.example.com',
'port' => 587,
'timeout' => 30,
'username' => '[email protected]',
'password' => 'password',
'log' => false,
'SMTPSecure' => 'starttls',
'tls' => true,
'context'=>array('ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
Controller
$email = new CakeEmail('ap');
$email->charset = 'ISO-2022-JP';
$result = $email
->config(array('log' => 'emails'))
->to(array($this->request->data['Order']['mail']))
->bcc(array(Configure::read ('Mail.Bcc')))
->from(array(Configure::read ('Mail.FromMail')=> 'MyBusinessName'))
->subject($this->request->data['Order']['order_subject'])
->send($this->request->data['Order']['message']);
if (!$result) {
$this->Session->setFlash(__('MailSend Failed Retry Again '));
return;
} else {
$this->OrderMailHistory->commit();
$this->OrderStateHistory->commit();
$this->Order->commit();
$this->redirect(array('action' => 'detail/', $this->request->data['Order']['id']));
}
}
Can someone please advise how we can get emails to be sent to Gmail?
Thanks so much!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论