开发者

Email help - php mail() or SMTP

I have a newsletter script which loops through members an开发者_JS百科d sends a mail to each individually. this was running ok previously, but as the numbers have increased, the script has started to crash part way through. I'm using SwiftMailer and the message I'm getting is "sending failed using mail() as PHP's default mail()". Would there be any benefit to trying to send with SMTP instead of the native mail() function? Or should I be looking at another solution. Thanks for any pointers.


The mail() function doesn't deliver mail, actually. It just hands over the mail you generated to the system's SMTP server. Either way, you're going to be using SMTP.

If swiftmailer is using PHP's mail() function, then most likely something's gone screwy with your system's SMTP setup. Check system logs (the maillog in particular) for clues, and see if Swiftmailer will give you any better error messages.


According to the suggestions of the smart guy who developed Swiftmail and proabably banged his head on these issues (in order to avoid you and me to do the same), it might help you to use SMTP and not mail transport

In my experience -- and others' -- the mail() function is not particularly predictable, or helpful.

Quite notably, the mail() function behaves entirely differently between Linux and Windows servers. On linux it uses sendmail, but on Windows it uses SMTP. ...

Serious drawbacks when using this Transport are:

  • Unpredictable message headers
  • Lack of feedback regarding delivery failures
  • Lack of support for several plugins that require real-time delivery feedback

It's a last resort, and we say that with a passion!

Moreover on the same page he also explains how to handle newsletters by simply iterating over the to field instead read section Sending Emails in Batch on the same page


The mail() function sends email with SMTP. You might want to try something like PEAR::Mail, however. Using mail() will open a new SMTP connection for each message, which is fairly inefficient to do inside a loop. This may very well be causing your errors, although with such a generic error message it's impossible to be sure without more digging.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜