Re: Sending out large amounts of email

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thank you all for some great answer and insights.

Special thanks to Chris, Nathan and Manuel for very valuable pointers and
sharing of information and experience.

For those interested in the subject..

We have our own servers, and since we want to be in control of the situation
ourselves we are not going to out-source the task.

I have chosen to go with a setup using PHPMailer on a mailserver running
Postfix and PostgreSQL. I have come to the conclusion that running PHPMailer
through the Sendmail binary (Postfix wrapper in this case) is the fastest
method.

Using Postfix this way doesn't use a queue, so what I do is that the script
saves the body and headers in a database table. In another table alle the
different email addresses is saved using a loop. Currently I am looking into
a better approach, but I haven't had the time yet. But I was thinking of
something like having a field for marking customers as receivers.

A cronjob is then run each two minuts (or something like that) calling a
small PHP script that uses PHPMailer to send out about 1000-3000 mails at a
time (it takes about 1 sec. and only about 24% of CPU power in our case
during that second). It loops through the customer emails.

Thanks to Chris I have looked into the subject of SPF, and I have created
the nesecary SPF TXT records for the relevant domain (thanks a thousand
Chris, I had completely forgotten about SPF).

I have run a couple of tests and so far every mailboks I have testet (Gmail,
Hotmail, different ISP's etc) have received the mail directly in the inbox,
except for Hotmail (typical) that puts the mail in the Junk box, but atleast
it gets through!

I have found this solution rather simple and very easy to maintain.

Best regards.

2009/3/6 Brian Hansen <greencoppermine@xxxxxxxxx>

> Hi.
>
> Our company is merging with another company and newsletter now needs to go
> out to more than 100.000 people. Before it was only a couple of thousands.
>
> I have developed a mail queue using a database and a cronjob, but I am not
> in doubt as to what particular solution I need to implement.
>
> I have been running some tests with PHP mail() function, PHPMailer and
> PEAR:Mail using 6000 mails at once.
>
> Here's a sumarry of some of the results:
>
> PHP mail() send out 6000 mails in 1.75 seconds.
> PHPMailer using PHP mail() send out 6000 mails in 1.87 seconds.
> PHPMailer using SMTP send out 6000 mails in 12 seconds (Error without
> succes).
> PEAR:Mail using PHP mail() send out 6000 mails in > 20 seconds (Apache
> reached 100% during this time).
>
> Running several test on PHPMailer using SMTP failed completely with more
> than 1000 mails.
>
> Everywhere on the net I read that sending out mail using PHP mail() is slow
> and it is a bad idea and that using some mail class with SMTP directly would
> be much better. I have tested the run my tests with Postfix as the SMTP.
>
> I have gotten the best results using PHP mail(). When the volume is belove
> 6000 PHP mail() is by far the fastest.
>
> Would someone mind sharing experience and perhaps shedding some light on
> this issue?
>
> What is the best solution in real life dealing with huge amounts of mail?
> PHP mail() vs. some class using SMTP or binary sendmail (or wrapper)?
>
> All insights would be appriciated.
>
> Best regards.
>
> Brian
>
>
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux