This page looks best with JavaScript enabled

Getting php mail() function running on Windows 8.1 with WAMP Server and configuring it to use Gmail’s SMTP servers

 ·   ·  ☕ 2 min read  ·  ✍️ Sathyajith Bhat · 👀... views

With the next Barcamp Bangalore looming round the corner, I’d pitched in to help with some of the website tasks. I installed the traditional WAMP stack with WAMP Server for Windows and started working with WordPress. Needed to get the email notifications working, saw that it wasn’t. Bit of research & found that I’d need a SMTP server or an equivalent of sendmail.

All the cool kids seem to be using Fake sendmail - I tried it to use with Gmail’s SMTP servers which uses authentication & TLS. Fake sendmail either would crash repeatedly or give a Socket Error # 10060 Connection timed out error.

Finally, after much trawling the Intarwebz, going through many forums & Stack Overflow posts, finally found this blog post which recommends using stunnel.

So this is what my php.ini settings look like:

[mail function]
; For Win32 only.
;SMTP = localhost
;smtp_port = 25

; For Win32 only.

sendmail_from = <the gmail id>

; For Unix only. You may supply arguments as well (default: "sendmail -t -i").

sendmail_path = "C:\wamp\bin\sendmail\sendmail.exe -t"

Yes, all parameters, except for sendmail_form & sendmail_path are commented. They are set in sendmail.ini & stunnel.



; SMTPS (SSL) support
; auto = use SSL for port 465, otherwise try to use TLS
; ssl = alway use SSL
; tls = always use TLS
; none = never try to use SSL

auth_username=gmail username
auth_password=gmail password


; Certificate/key is needed in server mode and optional in client mode
cert = stunnel.pem
socket = l:TCP_NODELAY=1
socket = r:TCP_NODELAY=1
key = stunnel.pem

accept  = 465
connect = 25

client = yes
accept =
connect =
Share on

Sathyajith Bhat
Sathyajith Bhat
Author, AWS Community Hero and DevOps Specialist

What's on this Page