How to send email from localhost using PHP on Linux

前端 未结 7 2069
别那么骄傲
别那么骄傲 2020-12-09 19:25

I know that to send e-mail from localhost on Windows, you need to change SMTP server in php.ini however this is valid only on Windows:

[mail function]
; For         


        
7条回答
  •  离开以前
    2020-12-09 20:04

    You need to install a MTA such as sendmail (Some distros like Debian seem to prefer exim, or maybe postfix).

    Using PHP's SMTP implementation is a bad idea, because it will not respect the retry requirement of RFC5321 "4.5.4.1. Sending Strategy: mail that cannot be transmitted immediately MUST be queued and periodically retried by the sender."

    This violation of an RFC "MUST" requirement generally reduces robustness and will interfere with correct interoperation in most cases. This is why you need to use a local MTA (under Linux or Windows). Ideally, you need a non-SMTP mechanism for submitting messages to the MTA, which is why PHP will should execute "sendmail" to send mail. It tends to do this by default if a MTA is installed.

提交回复
热议问题