Use default PHP mail function with SMTP server on Linux

后端 未结 2 1063
独厮守ぢ
独厮守ぢ 2020-12-20 17:18

I am working on a php/c# project which is an Email Server with a web interface to manage the Email Server application.

The program is supposed to work on windows an

相关标签:
2条回答
  • 2020-12-20 17:25

    You standard php mail function will just send to whatever is defined as the sendmail _path in php.ini

    This is typically sendmail -t -i

    You would need to configure sendmail to use smtp.

    FWIW, most developer who do a lot of mail sending from PHP apps revile the mail() and instead use one of many mailing libraries (or services) which provide better configurability/reliability.

    You could for example pipe the mail function to your own PHP script and use whatever library you wanted to in that script in order to do mail sending (and thus preserving the use of mail() function across applications).

    0 讨论(0)
  • 2020-12-20 17:25

    It's not possible to have the mail() function use an SMTP server on non-Windows systems.

    See the docs on the php.ini setting smtp.

    phpmailer has become a widely used PHP library for sending email. It supports a variety of options including SMTP and various authentication types and SSL/TLS. I'd recommend using that (or something similar See also Zend_Mail) if you need to send messages using SMTP.

    So you won't be able to use the mail function, but your only other option isn't Pear.

    0 讨论(0)
提交回复
热议问题