Failed to connect to mailserver at “localhost” port 25

前端 未结 8 1225
日久生厌
日久生厌 2020-11-22 10:34

I keep getting this error when I try to send an e-mail in PHP:

Warning: mail() [function.mail]: Failed to connect to mailserver at \"localhost\" port 25, ver         


        
8条回答
  •  生来不讨喜
    2020-11-22 11:09

    PHP mail function can send email in 2 scenarios:

    a. Try to send email via unix sendmail program At linux it will exec program "sendmail", put all params to sendmail and that all.

    OR

    b. Connect to mail server (using smtp protocol and host/port/username/pass from php.ini) and try to send email.

    If php unable to connect to email server it will give warning (and you see such workning in your logs) To solve it, install smtp server on your local machine or use any available server. How to setup / configure smtp you can find on php.net

提交回复
热议问题