Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

How to send emails from PHP on Windows

DZone's Guide to

How to send emails from PHP on Windows

· Web Dev Zone
Free Resource

Discover how to focus on operators for Reactive Programming and how they are essential to react to data in your application.  Brought to you in partnership with Wakanda

Requirements:

  • Windows OS
  • PHP
  • An account that you can send from (smpt server/user/pass)
  • 5-15 minutes

Download sendmail for Windows from
http://www.glob.com.au/sendmail/sendmail.zip
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)
force_sender=you-sender@yourdomain.com
force_recipient=you@yourdomain.com
By the way I uncommented debug_logfile so I can see what data is being sent to my SMTP server.

edit c:\php\php.ini

sendmail_from = you@yourdomain.com

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
sendmail_path = C:/usr/lib/sendmail.exe -t -i


Restart apache
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

Learn how divergent branches can appear in your repository and how to better understand why they are called “branches".  Brought to you in partnership with Wakanda

Topics:

Published at DZone with permission of Svetoslav Marinov, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}