Monthly Archives: September 2009

Using GMail with DSpace

gmailFrom time to time a DSpace repository will send emails. It does this when new users are added, when new items are added, when workflow tasks need to be completed, when exports have completed etc etc. For DSpace production servers this is normally trivial to set up; enter the name of your email server in the configuration file, enter the email address that emails should be sent from, and it usually just works

However for developers working on DSpace, it can be a bit harder. For good reasons (e.g. spam reduction etc), many institutions make their SMTP email servers accessible only from within their network. So if you are working on DSpace from home, a cafe, or on the train, you don’t have access to your institutional network because you don’t want to bother running VPN. An ideal solution to this problem would be to use a third party SMTP server outside of your institution which you can use which developing. An ideal candidate for this is Google’s GMail.

At present though, DSpace does not allow you to configure some of the more complex aspects of email server configuration like enabling SSL connections, or which SocketFactory to use. These need to be set in order to connect securely to the GMail servers. We’ve had an open issue in the DSpace JIRA issue tracking system to address this, and it has now been included ready for DSpace version 1.6, and can be easily back ported to earlier versions.

To use the GMail servers, configure dspace.cfg as follows:

# SMTP mail server
mail.server=smtp.gmail.com

# SMTP mail server authentication username and password (if required)
mail.server.username = your-user-name@gmail.com
mail.server.password = your-gmail-password

# Pass extra settings to the Java mail library. Comma separated, equals sign between
# the key and the value.
mail.extraproperties = mail.smtp.socketFactory.port=465, \
           mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory, \
           mail.smtp.socketFactory.fallback=false

If you are a Google Apps user this will also work if you substitute the username with your Google Apps email address.