note 66729 modified in ref.mail by danbrown
| From: | danbrown@php.net | Date: | Sun, 17 May 2009 20:13:58 +0000 |
| Subject: | note 66729 modified in ref.mail by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-155360@lists.php.net to get a copy of this message | ||
mail() opens a new connection for each email it sends out which causes some significant overhead if
you're sending out many emails in one go.
You can avoid this by using sockets like Antony Male has done and then send as many emails as you
like through the same connection. It should be noted however that some MTA's will reject your
emails after you've sent over a certain threshold on the same connection (about 10 would be
normal) so it's worth disconnecting and reconnecting periodically.
I'm surprised nobody has drawn attention to PHPMailer (http://phpmailer.sourceforge.net) which
makes this sort of stuff really easy. Even better still is Swift Mailer by Chris Corbyn
(http://www.swiftmailer.org) because it includes plugin support and it's tighter.
Another thing that's bitten me before is Magic Quotes! If it's turned on and you're
sending attachments that seem to arrive corrupted it's more than likely because your
attachments are full of backslashes.
Hope the links might be useful to some people :)
--was--
mail() opens a new connection for each email it sends out which causes some significant overhead if
you're sending out many emails in one go.
You can avoid this by using sockets like Antony Male has done and then send as many emails as you
like through the same connection. It should be noted however that some MTA's will reject your
emails after you've sent over a certain threshold on the same connection (about 10 would be
normal) so it's worth disconnecting and reconnecting periodically.
I'm surprised nobody has drawn attention to PHPMailer (http://phpmailer.sourceforge.net) which
makes this sort of stuff really easy. Even better still is Swift Mailer by Chris Corbyn
(http://www.swiftmailer.org) because it includes plugin support and it's tighter.
Another thing that's bitten me before is Magic Quotes! If it's turned on and you're
sending attachments that seem to arrive corrupted it's more than likely because your
attachments are full of backslashes.
Hope the links might be useful to some people :)
http://php.net/manual/en/ref.mail.php