Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
975 views
in Technique[技术] by (71.8m points)

email - Why shouldn't I use PHP's mail() function?

The general opinion when it comes to sending email messages in PHP is to stay clear of PHP's built-in mail() function and to use a library instead.

What I want to know are the actual reasons and flaws in using mail() over a library or extension. For example, the commonly specified headers that aren't included in a standard mail() call.

Question&Answers:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Quoting:

Disadvantages of the PHP mail() function

In some cases, mails send via PHP mail() did not receive the recipients although it was send by WB without any error message. The most common reasons for that issue are listed below.

  • wrong format of mail header or content (e.g. differences in line break between Windows/Unix)
  • sendmail not installed or configured on your server (php.ini)
  • the mail provider of the recipeint does not allow mails send by PHP mail(); common spam protection

Errors in the format of header or content can cause that mails are treated as SPAM. In the best case, such mails are transfered to the spam folder of your recipient inbox or send back to the sender. In the worst case, such mails are deleted without any comment. If sendmail is not installed or not configured, no mails can be send at all.

It is common practice by free mail provider such as GMX, to reject mails send via the PHP function mail(). Very often such mails are deleted without any information of the recipient.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...