Skip to main content
  1. Posts/

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

··289 words·2 mins·
Tips & How-To's PHP Sendmail

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.
; https://php.net/smtp
;SMTP = localhost
; https://php.net/smtp-port
;smtp_port = 25

; For Win32 only.
; https://php.net/sendmail-from

sendmail_from = <the gmail id>

;C:\wamp\bin\sendmail
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; https://php.net/sendmail-path

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.

sendmail.ini:

smtp_server=localhost
smtp_port=25

; 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
smtp_ssl=none

auth_username=gmail username
auth_password=gmail password

stunnel.conf

; 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

[ssmtp]
accept  = 465
connect = 25

[gmail-smtp]
client = yes
accept = 127.0.0.1:25
connect = smtp.gmail.com:465
Sathyajith Bhat
Author
Sathyajith Bhat
Author, AWS Container Hero and DevOps Specialist.

Related

Reviving my dead Windows 8 install with no bootable USB/DVD and Linux Mint & Cr48
··680 words·4 mins
News Tips & How-To's Cr48 Linux Mint Windows
Couple of months ago, just about a month before #cpgweds - the engagement my Envy 14 laptop started showing signs of dying - weird noises coming from the vents, system freezing arbitrarily, system getting incredibly hot - and that’s really unusual because the Envy’s cooling system is probably one of the best that I’ve seen in a laptop. Soon enough, it became clear that a fan was not working - my idle temperatures hit 85 degrees C, and start any game or even xbmc, and the temperatures would hit 95-100 and shutdown sooner or later.
SSH into your servers from Unity using unity-sshsearch-lens
··120 words·1 min
Tips & How-To's Ubuntu
I love Unity, especially the lens feature. While going through the Ubuntu store, found this neat little lens for initiating an SSH connection. The lens parses your ~/.ssh/known_hosts & ~/.ssh/config files and provides you with a list of servers that you can connect to. Just install the lens, logout & login back to your desktop and you're good to go. To search, just bring up Unity dash by hitting the Super (aka Windows) key, type either the username or host and just hit enter to initiate the connection.
Wallpaper Showing Keyboard Shortcuts And Mouse Tricks For Ubuntu Unity
··59 words·1 min
Tips & How-To's Ubuntu
Going through Ask Ubuntu, found a nice answer on keyboard shortcuts for Ubuntu Unity. Now if that’s too much for you to remember, Octavian Damiean has created this sweet wallpaper with the shortcuts and gestures overlayed on it. Click on the above image for a full size version, or a here’s a SVG version if you prefer the same.