Re: Re: Bulk Email [solution found!]
| From: | Paul Roberts | Date: | Sat, 17 Aug 2002 06:52:10 +0000 |
| Subject: | Re: Re: Bulk Email [solution found!] | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-113062@lists.php.net to get a copy of this message | ||
i tried it using the 5th parameter with -odd and the mail got qued but i also need to set
-fuser@user.com (so i get those bounces) but i got <fuser@user.com -odd> for the return path
in the email.
i then tried it with the -odd first and it qued the mail but didn't set the return path, i also
want to set it so it only returns the headers using -Rhdrs so need to set 3 options when sendmail is
called.
can you set multiple options with the 5th parameter? i would have thought it would append the stuff
in the 5th to the sendmail path set in php.ini but it doesn't seem to work that way.
i can do this fine by using popen() and adding the parameters to the path so i can't see why it
doesn't play with the mail function.
Paul Roberts
http://www.paul-roberts.com
mail@paul-roberts.com
++++++++++++++++++++++++
----- Original Message -----
From: "Manuel Lemos" <mlemos@acm.org>
To: <php-general@lists.php.net>
Sent: Saturday, August 17, 2002 2:36 AM
Subject: [PHP] Re: Bulk Email [solution found!]
> Hello,
>
> On 08/16/2002 05:37 PM, Daren Cotter wrote:
> > First, a recap of my problem:
> >
> > I need to send personalized emails to my member list
> > on a daily basis. I use PHP to query the MySQL
> > database, and loop through the results using the
> > mail() function. Problem: very slow, browser/php times
> > out, etc.
> >
> > Solution:
> >
> > First, I configure sendmail to use "queueonly" as the
> > DeliveryMethod (see sendmail.cf) instead of
> > "background". Then, when my PHP script runs, mailings
> > simply get queued instead of actually delivered. This
> > is a x10 speed increase. My script queues
> > approximately 1,000 mailings per minute (a x10 speed
> > increase). Then, I modified the
> > /etc/rc.d/init.d/sendmail script to process the queue
> > every 5 minutes, instead of the default one hour. This
> > insures that the mailings actually get sent soon after
> > they're queued, and you won't have to wait for
> > important emails to come through.
>
> As I mentioned before this solution is set for disaster as you grow into
> larger number of recipients. The problem is that queuing separate
> messages for each recipient will fill up your disk. But that is not all.
> The eventual message bounces that you will get will only aggravate your
> problem. If you can live without personalization, don't think twice,
> forget it. If you have doubts, think again.
>
>
>
> > The problem with the above solution used to be this:
> > certain emails generated from my site (welcome emails,
> > password lookup emails, etc) need to be sent
> > IMMEDIATELY, and cannot wait in the queue for 5
> > minutes. The solution for this: not using the built-in
> > mail() command in PHP. I created my own mail script
> > (by modifying something someone else already did)
> > which opens a socket directly with the mail server.
> > Code is below.
> >
> > // Sends the email directly to the mail server using
> > SMTP. This is done
> > // so sendmail can be setup using the queue method on
> > the server, and
> > // confirmation emails, etc, can be sent immediately
> > to the member.
> > function smtp_mail($to, $from_name, $from_email,
> > $reply_to_email, $subject, $body) {
> > $smtp = fsockopen("your_mail_server_here", 25);
>
> I am not sure that sending to the local mailer queue via SMTP would be
> any better than using sendmail itself to put the message there. Anyway,
> I am afraid that the message will still wait for sendmail to process it
>
>
> > if ($smtp == 0)
> > return 0;
> > fputs($smtp,"helo
> > machines_host_and_domain_name_here\r\n");
> > $line = fgets($smtp, 1024);
> > fputs($smtp,"mail from: $from_email\r\n");
> > $line = fgets($smtp, 1024);
> > fputs($smtp,"rcpt to: $to\r\n");
> > $line = fgets($smtp, 1024);
> > fputs($smtp,"data\r\n");
> > $line = fgets($smtp, 1024);
> > fputs($smtp,"From: $from_name <$from_email>\r\n");
> > fputs($smtp,"Reply-To: $reply_to_email\r\n");
> > fputs($smtp,"To: $to\r\n");
> > fputs($smtp,"Subject: $subject\r\n");
> > fputs($smtp,"\r\n");
> > fputs($smtp,"$body\r\n");
> > fputs($smtp,".\r\n");
> > $line = fgets($smtp, 1024);
> > fputs($smtp, "QUIT\r\n");
> > fclose($smtp);
> > return 1;
> > }
>
> I am afraid this code needs a lot of work or else it will choke on some
> servers due to multi-line responses, maybe not on the actual sendmail
> version and configuration you are using, but definetely on some SMTP
> servers.
>
>
> --
>
> Regards,
> Manuel Lemos
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>