0

What script, class or function you use to send many emails, excluding the in-built 'mail' function and excluding the PEAR Mail (many problems and compatibility issues in PHP 5.3).

I want to send about 5000 emails per 'shot', but 'mail' function connect and disconnect for each email. PEAR Mail have many problems.

I've tried Swiftmailer, but the HTML appears duplicated in many clients (because apparently it is attached).

Is PHPMailer the answer?

PS: Sorry for the typos. I'm Brazilian.

PeeHaa
  • 71,436
  • 58
  • 190
  • 262
Paulo Coghi
  • 13,724
  • 14
  • 68
  • 90

2 Answers2

2

Before implementing our own system we used PHPMailer with the isSMTP() option and saw throughput of about 20 emails / sec (build time + send). If you have static content your throughput should be a bit higher.

There is an option to use a persistent SMTP connection.

jasonbar
  • 13,333
  • 4
  • 38
  • 46
  • what is persistent SMTP connection. – Jayapal Chandran Dec 20 '10 at 16:02
  • 1
    @Jayapal Chandran: Usually an SMTP session is started and ends after a single message is transmitted. With a persistent connection, the session is maintained so you don't have to go through opening and closing the socket / the SMTP handshake, etc.. – jasonbar Dec 20 '10 at 17:32
1

PHPMailer will do what you want, though if you use it as a page load, be mindful of your page execution time limits. If you go over you want to be able to pick up where you left off. This presumes each mail is being customized per each user.

Based on that experience, I stopped using web-browser loading of such PHP scripts, and instead now do them on the command line.

artlung
  • 33,305
  • 16
  • 69
  • 121
  • What is the difference if I'm sending static email? My cron has to run one db query and then it can assemble a single message that applies to all recipients. Does this change anything in the implementation? – JLeonard Aug 11 '10 at 19:49
  • @John: In that case, there's no browser involved that could cancel the connection (because it takes too long to load the page). – Marcel Korpel Aug 11 '10 at 19:53
  • John, you mention cron, are you calling php as an executable (in which case the page load limits won't apply) or are you calling a page via wget (in which it will) or something else. I'm not sure I understand your question – artlung Aug 12 '10 at 00:32