Month: April 2012
A recent commenter on the blog mentioned that using a gmail address as the sender address from the tcPrettyEmail plugin was not working due to the fact that smtp.gmail.com wants to use TLS.
I had a quick look through the javax.mail API docs and a browse over stackoverflow, and found that enabling STARTTLS support would be relatively simple. I’m using the spring mail wrapper because it’s bundled with TeamCity, and found that you can pass in extra options using a standard JavaProperties object.
So a few extra lines of code to support the extra tag in TeamCity’s main-config.xml file was all that was really needed to enable it.
While I was pushing a new version, I fixed a couple of missing image files that were causing messages to fail for some less common email message types.
The enable starttls, simply add an argument to the smtp tag (nested inside pretty-email) in main-config.xml. You will probably need to add your username and password to the file as well. Here is an example using gmail as the sender:
<pretty-email> <smtp host="smtp.gmail.com" port="587" username="myGmailUsername" password="myGmailPassword" from-address="myGmailUsername@gmail.com" from-name="Friendly Name" starttls-enabled="true" /> </pretty-email>
For futher detail, please see the documentation.