Zend_Mail 发送完美,但需要很长时间才能到达 gmail
我正在尝试通过 gmail smtp 发送邮件。该过程工作正常,但由于某种原因,在更改发送结构后,邮件需要很长时间才能到达 gmail。我可以等待 20 分钟或更长时间,系统发送的一封邮件才会投进来,但收件箱中仍然显示为(20 分钟前)。关于我做错了什么的任何线索吗?
$config = Zend_Registry::get('Zend_Config_Ini');
$tr = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $config->mail->toArray());
然后,在要发送的邮件的 foreach 中:
$mail = new Zend_Mail('UTF-8');
$mail->setType(Zend_Mime::MULTIPART_RELATED);
if (isset($pendingMail['senderMail']))
$mail->setFrom($pendingMail['senderMail'], $pendingMail['senderfName'] . " " . $pendingMail['senderlName']);
$mail->addTo($pendingMail['receiverMail']);
$mail->setSubject($pendingMail['mailSubject']);
$mail->setBodyHtml(urldecode($pendingMail['mailContent']));
$mail->send();
$this->update(array('sent' => 1), 'idMail = \'' . $pendingMail['idMail'] . '\'');
这与 MULTIPART_RELATED 类型有关还是我在这里缺少什么?重申一下:邮件可以正常工作,但到达 Gmail 后大约 20 分钟就会出现在 Gmail 收件箱中。哈尔普?
I'm trying to send mails through gmail smtp. The process works fine and all, but for some reason, after altering the sending structure, the mails take AGES to arrive to gmail. I can wait 20 minutes or more for one of the system sent mails to drop in, but it is still displayed as (20 minutes ago) in the inbox. Any clues on to what I'm doing wrong?
$config = Zend_Registry::get('Zend_Config_Ini');
$tr = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $config->mail->toArray());
Then, in a foreach for mails to be sent:
$mail = new Zend_Mail('UTF-8');
$mail->setType(Zend_Mime::MULTIPART_RELATED);
if (isset($pendingMail['senderMail']))
$mail->setFrom($pendingMail['senderMail'], $pendingMail['senderfName'] . " " . $pendingMail['senderlName']);
$mail->addTo($pendingMail['receiverMail']);
$mail->setSubject($pendingMail['mailSubject']);
$mail->setBodyHtml(urldecode($pendingMail['mailContent']));
$mail->send();
$this->update(array('sent' => 1), 'idMail = \'' . $pendingMail['idMail'] . '\'');
Is this related to the MULTIPART_RELATED type or what am I missing around here? To reiterate: The mails work, but they show up in the gmail inbox about 20 minutes after arriving to gmail. Halp?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它可能不是您的代码,而是作为某些缓存系统的 SMTP 服务器。
你的代码对我来说似乎没问题。
It might not be your code, but your SMTP server that as some cache system.
Your code seems ok to me.