PHP: how to send email basics

前端 未结 7 1179
滥情空心
滥情空心 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:33

    You need the software that will actually send the email after your PHP script has made a request to so (through using the mail function: http://php.net/mail). As stated in some of the previous responses there are software options for this, regardless of what operating system you run.

    This, however, can sometimes be quite tricky for a beginner. Typically your ISP will give you access to an SMTP server from which to send emails, and you can set up your configuration to do this. For development purposes, this ought to do the trick for you. These details will likely be on your ISP's website (or possibly in your email client, somewhere.) Your config would end up looking something like

    [mail function] ; For Win32 only.
    SMTP = smtp.my-isp.com
    smtp_port = 25
    sendmail_from =my.account@my-isp.com
    

    Failing that, you could just upload your script to your web host, where it should already be configured to work.

    Hope that helps.

提交回复
热议问题