How to send email from localhost using PHP on Linux

前端 未结 7 2084
别那么骄傲
别那么骄傲 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条回答
  •  旧时难觅i
    2020-12-09 20:14

    There should be a stub in your php.ini file already, something like:

    ; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
    sendmail_path = /usr/sbin/sendmail -t -i
    

    Check that the command specified exists on your filesystem and you have (installed and) configured the MTA correctly.

    If you've not already got an MTA set up, there are lots of MTAs available for Linux systems, I'd recommend sendmail (comples/difficult to configure but great performance and amazing flexibility) or postfix (easier to configure, good security out of the box).

    Learn how to use the 'mail' cli client or run a different MUA on the server to seperate configuring the MTA from PHP integration.

提交回复
热议问题