Re: Issues with Mail (SMTP) and Mime_Mail
| From: | Andres Ferrando | Date: | Fri, 02 Aug 2002 18:32:18 +0000 |
| Subject: | Re: Issues with Mail (SMTP) and Mime_Mail | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-2028@lists.php.net to get a copy of this message | ||
Hi!
I'm just a reader here, I don't use yet PEAR.
But, I can give some tips:
first: compile php as standalone for this kind of jobs, and don't do I
from a webserver, 'cause you also have timeouts from server and other
issues ...
second: this unset is erasing the Subject
third: this process is usually very heavy, so avoid adding any overload
to it ...
> Hello,
>
> i'm currently modifying an online mailing tool so that it uses the
> Mime Mail and Mail packages.
>
> Before the changes, i was sending the emails using PHP's mail
> function, and everything was going fine. Now that i'm using
> Mail::factory('smtp'), i run into big issues, and i need to know if
> i'm doing something wrong before i start editing the whole package :)
>
> First weird thing, not all the emails are sent; I have in my list like
> 3500 addresses, and it stops after 500 or 600 messages sent. The
> browser keeps on loading during a few minutes, then displays a blank
> page, and a DNS error a bit later. I can see in exim's log that the
> send process is not stopped. Only a few minutes later, it stops.
> Of course, there is no time limit on the script that sends the
> emails...
>
> Second one, most messages are sent twice ! Once, then another time at
> about 5 - 6 minutes later.
>
> When i run a test with a small amount of recipients, there are
> absolutely no errors, and the messages are only sent once.
> Do you think that the error(s) could come from the smtp server ? If
> the answer is yes, then what can i do ?
>
> Thanks in advance,
>
> --
> Katana mailto:katana@katana-inc.com
>
>
> Addon: Here is the part of my code that sends the emails.
>
> $headers = array(
> 'From' => $from =
> stripslashes(trim($_POST['mailsender_name'])),
> 'Reply-To' => $from,
> 'Return-path' => $from,
> 'Return-Errors-To' => $from,
> 'X-Mailer' => sprintf('Interact HTMLMailer v%s',
> $version),
> 'Subject' => sprintf('[Interact Mailing Lists Manager]
> %s', stripslashes(trim($_POST['mail_subject']))),
> 'To' => $to
> );
>
>
> // Send the confirmation email to the the user
> $body = $mime->get();
> $hdrs = $mime->headers($headers);
> $mail =& Mail::factory('smtp', array('host' =>
> 'localhost'));
> $res = $mail->send($to, $hdrs, $body);
> unset($mime->_headers);
>
> // Send the mailing to every recipient of the mailing list
> $headers['Subject'] = $_POST['mail_subject'];
> $mailsSent = 0; $errors = 0;
> foreach($emailsdest as $emaildest) {
> $headers['To'] = $emaildest['email'];
> $body = $mime->get();
> $hdrs = $mime->headers($headers);
> if ($res = $mail->send($emaildest['email'], $hdrs, $body)) {
> $mailsSent++;
> }
> else {
> $errors++;
> }
> unset($mime->_headers, $hdrs);
> }
--
Andres Ferrando <anferr@mecon.gov.ar>