tcPrettyEmail TeamCity plugin now supports STARTTLS

Posted on Updated on

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 new version is uploaded to the sourceforge download page and the docs updated to include the new field.

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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s