问题
I'm having problems using the mail
command in PHP through an offline server.
I've used the mail(to, subject, body)
function but the mail wasn't sent to the address. Should I be online?
回答1:
No, your problem is that you have no SMTP server installed. I suggest you to check on of these:
Pdf tutorial to create your own SMTP Server
Online tutorial
Online tutorial #2
Alternative way to find out
After successfull setting it up, you'll need to configure your php.ini too, to point at the SMTP you are using.
Or instead of creating your own, you can google how to use someone else's SMTP. The choice is yours.
回答2:
if you are running code from local server then mail function will not send mail. Mail function need live mail server. You can use smtp mail to send mail from local server.
来源:https://stackoverflow.com/questions/29716458/using-offline-server-in-php