Use PHP mail to send via smtp

前端 未结 5 1251
情话喂你
情话喂你 2021-01-20 11:41

Does anybody know if you can configure php\'s mail() command so it will only use an SMTP server rather than the local sendmail? We are having trouble with emails being marke

5条回答
  •  后悔当初
    2021-01-20 12:11

    No, the reason is that all Linux/Unix systems should have a "sendmail" tool. The benefit there is that this external tool can handle timeouts or unresponsive SMTP servers so it becomes more likely the mail is being really sent. The SMTP client implementation for Windows is a work-around for the fact that "sendmail" doesn't exist there.

    My approach would be to use a sendmail-compatible tool that just talks to another server using SMTP. A simple tool for that is ssmtp (sources avialable here)

提交回复
热议问题