How to send emails from PHP on Windows
- Windows OS
- An account that you can send from (smpt server/user/pass)
- 5-15 minutes
Download sendmail for Windows from
Copy sendmail.exe and sendmail.ini into C:/usr/lib/
Edit sendmail.ini and enter your mail account credentials.
You might want to configure these 2 fields as well (or sending may not work)
By the way I uncommented debug_logfile so I can see what data is being sent to my SMTP server.
sendmail_from = email@example.com
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
sendmail_path = C:/usr/lib/sendmail.exe -t -i
Start sendmail.exe either from [Start] > Run > C:/usr/lib/sendmail.exe or Go to C:/usr/lib in Windows Explorer and then DoubleClick on the exe file.
... and now the best part - Testing
Here is an example from http://php.net/manual/en/function.mail.php
Create a file called m.php in htdocs
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)