As a server-side developer you are often sending emails from your web application, whether those emails be for debugging/exception handling or actual application functionality (such as a contact form etc).
Although some developers decide to turn off mail debugging locally (and instead view the errors inline), you pretty much always have the need to send emails from your development environment.
In the past I have either connected to a staging mail server or used a free SMTP server (installed locally on my workstation) like MailEnable. Well today Marko Tomic let me in on something which is probably already well known! You can setup GMail as an SMTP server in ColdFusion Administrator :)
What this means is you now don’t have to bother installing your own SMTP server or getting mail details from your systems administrator…you can just use your very own gmail account! Nice.
Note that I did also google this a bit and found a couple of posts including this one suggesting you use TLS (via the Administrator or cfmail attributes), but I needed to use SSL instead. I had no success with TLS.
Also reading the docs I’m not sure if this will work pre-CF8, as SSL and TLS were added as attributes in CF8.
Below are some examples of setting this up either in Administrator or in code, note the port number is not 25 as is the default, instead you must use port 465:
And in CFML:
<cfmail to="firstname.lastname@example.org" subject="Read me" from="email@example.com" server="smtp.gmail.com" useSSL="true" username="gmailUsername" password="gmailPassword" port="465"> This is a test email! </cfmail>
The nice thing about doing this in ColdFusion administrator (apart from not having to specify a cfmail server and username/password etc in your code) is that you can verify your connection to the SMTP server.