PHP: how to send email basics

前端 未结 7 1324
滥情空心
滥情空心 2021-01-28 18:05

I\'m would like to use PHP to send email from my localhost to other people. What do I need to do that?

For example do I need to install mailserver? If I\'m not mistaken

7条回答
  •  忘掉有多难
    2021-01-28 18:42

    The simple way is by using the mail() command. On Linux it's a pipe to sendmail binary and on Windows, I don't know, probably it use some Microsoft voodoo library.

    Anyway, I strongly recommend to use phpMailer because it's a mature project, really stable, easy to setup, with a lot of features and it also includes an SMTP and IMAP client implementation, so absolutely cross-platform.

    Anyway, you should consider to use anyway a local SMTP server as first hop to handle the mail queue in case of network failure.

提交回复
热议问题