Hi,
haptiK wrote:
How then would this behave if im sending thousands of emails to my users
as opposed to threading the mail process? over all performance?
thanks again for your response.. im new to the theory of threaded
processes and they sound interesting but if im headed down the wrong
trail with this i appreciate your patience.
Using Bcc, with the Bcc field containing the thousands of addresses,
means the the PHP process only sends one email to your mail server very
quickly. It is then up to the mail server to copy it out to everyone on
the Bcc list. This is also more efficient for the Internet, as if 200
people at example.com need a copy, your mail server will pass 1 copy to
example.com's email server with the 200 recipients listed, and
example.com's mail server will copy that message to all 200 people,
saving a lot of Internet bandwidth.
You couldn't easily use multithreading easily for what you want, as the
PHP process (and so page transfer) won't finish until all the threads
finish (you could possibly make your web server stop the request by
closing the filehandle, but its not guaranteed - your web server might
wait until it can reap the process).
You could use program execution functions (eg fork() and exec() under
Unix, or your OS moral equivilent) to send the messages from another
process and then have the main process return before the other one, but
check you don't end up with zombies.
Most Internet people would prefer you use the 1st method,
Bcc:
a@example.com,
b@example.net,
c@example.org
Because it saves bandwidth, and if two addresses are mapped to the same
account they often won't get duplicates, but it does mean you can't
'personalise' the emails. But it also neatly puts the time-to-send
problem off PHP and on to the mail servers, optimised to do the job :-)
Regards,
Luke