note 66729 deleted from function.mail by danbrown

From: Date: Sun, 17 May 2009 20:14:38 +0000
Subject: note 66729 deleted from function.mail by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-155361@lists.php.net to get a copy of this message
Note Submitter: chris at w3style dot co dot uk ---- 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 :)

« previous php.notes (#155361) next »