tags:

views:

213

answers:

1

Hi all, 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?

A: 

It might not be your code, but your SMTP server that as some cache system. Your code seems ok to me.

Clement Herreman
Well, you know. Apparently it was something exactly like it. After hours and hours of vast delay times, it was suddenly delivered with zero delay time. I am confused and aroused.
John
Did you change anything just before it became lightning fast ? Unless you did, I guess it what server related
Clement Herreman
Nono, didn't change anything at all. Strange things happen to all of us, I guess.
John