I have a php script set up to generate emails. Currently, they give the开发者_JS百科 success message but don't actually send the email.
I just had a look in the php configuration settings file, and I noticed this:
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25
Is this where I change the SMTP to the address I need the emails to be relayed through?
Any help would be appreciated, thanks :)
When you're on Windows, PHP's mail function can use a SMTP server. (That is because Windows lacks Unix/Linux's centralized, standardized mailing functions.)
However, its possibilities are very limited: It supports neither authentication nor encryption - both things that most mail services require nowadays.
If you want to use an external SMTP server (like Google Mail's), an external mailing class like Swiftmailer that can connect to SMTP servers using SSL/TLS and authentication.
Otherwise,a lightweight mail server like Mercury can accept local E-Mail and "re-send" it through a proper SMTP server.
Yes you can set the server that's going to be used to send mails via SMTP there (as the comment states, this is WIN32 only!). I however suggest you have a look at phpmailer, which eases your work with sending mails in php. It supports custom SMTP settings aswell.
精彩评论