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

# SMTP mail server authentication username and password (if required)
mail.server.username =
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, \
 , \

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

19 thoughts on “Using GMail with DSpace

  1. Rodrigo Dalmonico

    Man you do a good job here, i try to configure but it doesnt work, can you help me to fix it?
    Thank you.

  2. Nasser Al-Kindi

    Thanks a lot Stuart Lewis, I did works to me thanks you.
    I appreciate your effort to describe the solution.

  3. Armando

    how I can change the log path dspace users of XMLUI to jspui, when I send the confirmation email you send me the url like this:
    localhost: 8080/xmlui? token125sdaasd5 but the log files are on localhost: 8080/jspui/register.

  4. Dspace user

    I have changed the config file settings as mentioned but still not working.Also I want ot confirm that both the Dspace -src and Dspace folders config file needs to be changed

  5. Bruce Jensen

    An important thing to watch for: Gmail might initially deny the “suspicious” login from the unfamiliar DSpace domain. So if you get mail errors in DSpace after following Stuart’s instructions, check first by logging into the Gmail account. If that’s the problem you’ll see an unmissable bright red bar across the top of the page. Google then enables you to allow connections from the DSpace host.

  6. Onkar Rai


    I am using Dspace-3.1-src-release on Windows XP. While creating administrator i.d C:\Dspace\bin\dspace create-administrator
    I got

    Creating an initial administrator account
    E-mail address:
    First name: Onkar
    Last name: Rai
    WARNING: Password will appear on-screen.
    Password: xxxxxxxxxxx
    Again to confirm: xxxxxxxxxxx
    Is the above data correct? (y or n): y
    Exception: null
    at java.util.regex.Matcher.getTextLength(Unknown source)
    at java.util.regex.Matcher.reset(Unknown source)
    at java.util.regex.Matcher.(Unknown source)
    at java.util.regex.Pattern.matcher(Unknown source)
    at org.dspace.eperson.Group.find(
    at org.dspace.administer.CreateAdministrator.createAdministrator(
    at org.dspace.administer.CreateAdministrator.negotiateAdministratorDetails(
    at org.dspace.administer.CreateAdministrator.main(
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown source)
    at java.lang.reflect.Method.invoke(Unknown source)

    I tested database connectivity . Its connected successfully
    C:\Dspace\bin\dspace test-database
    Testing connection –
    Connected sucessfuly

    But when I tested E-Mail setting I got an Error
    C:\Dspace\bin\dspace test-email
    got Error sending Email:
    -Error: javax.mail.MessegingException: Could not connect to SMTP Host:, port :25;
    Please see the Dspace documentation for assistance.

    Kindly Help me to Overcome this Problem.

    Thanks in Advance

    Onkar Rai

  7. Pingback: Usar Gmail como servidor SMTP | Blog Rodrigo Torrens

  8. djanahana


    i have my dspace application in here, i have try to follow those steps but i didn’t find the correct result, any help i will be aprreciate.

    another question, if you guide me how I can delete the 8080/jspui from the URL I will be apreciate

    thanks in advance

  9. Andy

    Dear Stuart,

    I trust all is well.

    I have tried to implement this solution and I have not had any luck.

    I am running Dspace 4.1 on my local laptop (Windows 8.1) and Apache Tomcat/7.0.54.

    My issue is that when update my dspace.cfg file it gets over written when I run the ant ‘update’ command.

    What am I doing wrong?

    Thanks in advance.


  10. Harris Manyozo

    Stuart, I like your guide simple and straight forward. It worked for me. On another note I want to ask a question. How do I make my dspace repository to alert me when i have submitted a duplicate file/article? Please assist.

  11. Ran

    I have installed dspace 5.5 . I have an issue about “user register” when I do this so Get an error “internal error” message.
    How can I fix it. I know that Gmail port would be (25, OR 465, OR 587)
    But didn’t working still.Reply me please.

  12. Ran

    I have installed dspace 5.5 . I have an issue about “user register” when I do this so Get an error “internal error” message.
    How can I fix it. I know that Gmail port would be (25, OR 465, OR 587)
    But didn’t working still.Reply me please.

Leave a Reply

Your email address will not be published. Required fields are marked *