Today I realized that the Moodle installations on my laptop were not able to send email notifications. I have previously used the smtp (email) server of an Australian Internet service provider without any problem. One of the downsides of traveling through Asia is that you tend to see far more of the security precautions companies take on the Internet than you do in a western country.
From here in Malaysia, however, that doesn’t seem to work. I guess they’re doing some sort of IP address lookup blocking to prevent people outside of Australia from sending email from their servers. That makes sense but its a bit awkward for me. After some googling Google’s own gmail servers seemed a suitable replacement. I have a gmail login so should be able to access their mail servers. And I did in fact eventually get this to work but there was one nasty little gotcha.
My googling told me that the appropriate smtp server was smtp.gmail.com. Setting my Moodle’s smtp server setting to smtp.gmail.com flat out didn’t work. Moodle couldn’t find the server. That’s weird.
After a bit more googling I tried smtp.gmail.com:465. Apparently google’s email works on port 465 if its using SSL authentication. Then I was getting this error:
SMTP Error: Could not authenticate. ERROR: SMTP Error: Could not authenticate.
At first I thought that maybe I didn’t have the appropriate software installed to use SSL. After some detective work it turns out I already had opensll installed so it probably wasn’t that.
After some time and a cup of tea inspiration struck. If this is using SSL shouldn’t the URL be something like ssl://smtp.gmail.com:465?
Bingo! That worked. All it needed was the ssl:// on the front and it all worked fine 🙂