From Script | Spoken-Tutorial
Revision as of 23:19, 13 January 2021 by Pravin1389 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Script : Email Configuration for DSpace on Windows

Author : Pankaj Patil

Keywords: DSpace Rebuild, DSpace Email Configuration, dspace.cfg, Rebuild script, DSpace gmail configuration,

Visual Cue Narration
Slide: Title Welcome to this Spoken Tutorial on Email Configuration for DSpace on Windows OS.
Slide: Learning Objectives In this tutorial, we will learn to
  • Configure an email for DSpace
  • Prepare a Batch file to rebuild DSpace and
  • Send a test mail from DSpace
Slide: System requirements This tutorial is recorded using
  • Windows 10 64 bit OS
  • DSpace version 6.3
  • WordPad and
  • Firefox web browser

However you may use any other text editor or browser of your choice.

Slide: Pre-requisites To practice this tutorial,
  • You should have installed DSpace 6.3 and
  • You should have a working internet connection.
Slide: Pre-requisites
  • If not then go through the prerequisite installation tutorials on this website.
Slide : Code files
  • The commands used in this tutorial are in a file in the Code Files link on this tutorial page.
  • Please download and extract the file before practicing.
Switch to WordPad and open the file I have opened the commands file in WordPad on my machine.

And I will use the same file to copy-paste the commands during the demonstration.

The shortcut to paste on the Command Prompt is Ctrl and V keys.

Slide: Necessity of Email Configuration In DSpace we have to configure the email settings to send emails from DSpace.
Slide : Necessity of Email Configuration DSpace sends emails to the users for various activities such as
  • Email verification during registration
  • Notification emails during Item submission and review
  • Getting Dspace user’s feedback and
  • Notifications to Community and Collection subscribers
Only Narration Let us begin.
Browse C Drive >> dspace-6.3-src-release >> dspace >> config In the file browser, go to C Drive.

Browse and navigate to the config folder in dspace-6.3-src-release as shown.

Open dspace.cfg with Wordpad Open the configuration file dspace.cfg in WordPad editor.
Point to dspace.cfg in WordPad dspace.cfg file is now open in WordPad.
Point to Email settings Scroll down and locate the Email settings section.
Slide: SMTP Services DSpace requires SMTP service to send and receive emails.

SMTP services like Gmail, SendinBlue, SendGrid, Pepipost, Amazon SES or Mandrill can be used.

Additionally, custom SMTP services can also be set up and used as well.

mail.server = smtp.gmail.com In this demonstration, I will configure a Gmail SMTP mail server.

So, first I’ll set the value for mail.server as smtp.gmail.com

mail.server.username =dspace.u1@gmail.com

mail.server.password =********

Next we have to give a valid gmail ID for mail.server.username.

I will use the admin’s mail id, which is dspace.u1@gmail.com

You can also use the same email id which you gave as your admin mail id.

The value for mail.server.password has to be the password of dspace.u1@gmail.com.

The typed password will be visible to everyone.

So I have blurred it for this demonstration.

Type # in front of the line


We will now use gmail’s SMTP port (SSL): 465, to connect to the SMTP server.

So, let us disable the default SMTP port which is 25.

To do so, type # in front of the line mail.server.port.

Set from Address of the email recipients

mail.from.address = dspace.u1@gmail.com

Now, give a valid email address for mail.from.address.

This email id will be considered as the from address for the recipients.

Here I will type the value as dspace.u1@gmail.com

Set Feedback recipient email address


Please type a valid email address for feedback.recipient

If a user submits any feedback in DSpace, then their feedback will be sent to this email id.

Here also I will type the value as dspace.u1@gmail.com

Set email address for mail admin


Next, we have to give a valid email address for mail.admin.

System notifications and administration emails will be sent to mail.admin address.

I will type the value as dspace.u1@gmail.com here.

Mail.extraproperties >> remove # symbol Next, we will configure the SMTP port (SSL): 465.

Scroll down and locate the line #mail.extraproperties.

Remove # symbol at the beginning of mail.extraproperties.

Remove # symbol Also, remove # symbol at the beginning of the next two consecutive lines, as shown.
Save and close file Then, save and close the file.
Slide : Rebuild DSpace Whenever we customize DSpace, it is necessary to rebuild DSpace.

Rebuild process involves

  • Compilation of source code
  • Installation of Webapp and
  • Deployment of DSpace on Tomcat server.

We will prepare a Batch file to rebuild DSpace, and use it whenever required.

Open Wordpad So, open Wordpad.
[Wordpad] type:

call cd C:\Program Files\Apache Software Foundation\Tomcat 8.5\bin

call Tomcat8.exe stop

call cd C:\dspace-6.3-src-release

call mvn -U clean package

call cd C:\dspace-6.3-src-release\dspace\target\dspace-installer

call ant fresh_install

call cd C:\Program Files\Apache Software Foundation\Tomcat 8.5\bin

call Tomcat8.exe start

And type the commands as shown.

We have used these commands in the earlier tutorial to build dspace.

Press Ctrl+S keys Save the file by pressing Ctrl + S keys together.

A dialog box to save the file appears.

Select Desktop location to save file On the left, select Desktop as a location to save the file.
Click on dropdown of Save as type -> Text Documents Click on the Save as type dropdown and select the type as Text Documents.
Enter File name


In the File name field, type the name as Rebuild-DSpace.bat.
Narration only .bat extension indicates that it is a batch file.
Click on Save button Click on the Save button.
Point to Dialog box A dialog box opens to confirm this save.
Click Yes button Click on the Yes button.
Close Rebuild-DSpace.bat file Close Rebuild-DSpace.bat file.
Narration only Now let us rebuild DSpace using the Rebuild-DSpace.bat file.
Go to the Desktop

Right click on Rebuild-DSpace >> Run as Administrator

Go to the Desktop and locate the file Rebuild-DSpace.

Then right-click on it and select Run as Administrator.

Click on yes If prompted, click on the Yes button in the User Account Control dialog box.
Point to Command Prompt The Command Prompt opens and the process of DSpace rebuild begins.
Point to BUILD SUCCESSFUL message On successful completion, BUILD SUCCESSFUL message will appear on the Command Prompt.
Show closing of Command Prompt After the rebuild process, the Command Prompt closes automatically.
Narration only This means we have deployed DSpace email configuration on Tomcat server.
Narration only Next we have to configure some settings in the Gmail account which we have used.

To access Gmail through DSpace, less secure apps in Gmail settings should be turned ON.

[browser] Login to gmail as Email: dspace.u1@gmail.com

Password: *********

To do so, login to the respective Gmail account which you had typed in the Email settings of DSpace.
[browser] Type the url:

https://www.google.com/settings/security/lesssecureapps https://www.google.com/settings/security/lesssecureapps

Then in the address bar type the URL as shown.
[browser] Turn the toggle on for Allow less secure apps Turn ON the toggle button for Allow less secure apps.
Open new tab in the browser Open a new tab in the browser.
[browser] Type https://accounts.google.com/DisplayUnlockCaptcha Enter the URL as shown to configure google account’s access to DSpace.
Click the Continue button Click the Continue button.
Close tab for Less secure app access and google account access tab Close the tab for Less secure app access and google account access.
Only narration We have now done the required configurations.

Next let us send a test mail.

Open the Command Prompt. To do so, open the Command Prompt.
[Command Prompt] Type:

cd C:\dspace\bin

Using cd command switch the present working directory to dspace bin.
[Command Prompt] type:

dspace test-email

Then type this command to send a test email.

Test email will be sent to the mail id which was set in mail.admin in dspace.cfg file.

[Browser] Open the gmail account Let us cross-verify this.

Switch to the browser where our mail account is logged in.

Now check the Inbox for the new mail.

[Browser] Point to the DSpace test mail Here is the DSpace test email.

We have successfully configured the mail configuration and also sent a test mail in DSpace.

Logout from gmail Once done, sign out from the Gmail account.
Close the command prompt And close the command prompt.
Slide: Troubleshoot Email Errors If you didn’t receive the email then check the following.
  • Check the Spam folder
  • Recheck your Internet connection or
  • The Email configurations in dspace.cfg
Only Narration This brings us to the end of this tutorial.

Let us summarize.

Slide Summary In this tutorial, we learnt to
  • Configure email for DSpace
  • Prepare a Batch file to rebuild DSpace and
  • Send a test email from DSpace
Slide : About Spoken Tutorial project The video at the following link summarises the Spoken Tutorial project.

Please download and watch it.

Slide : Spoken Tutorial workshops The Spoken Tutorial Project team conducts workshops and gives certificates.

For more details, please write to us.

Slide: Answers for THIS Spoken Tutorial Please post your timed queries in this Forum.
Slide: Acknowledgement -I Spoken Tutorial project is funded by Ministry of Education (MoE), Government of India.
Slide: Acknowledgement -II DSpace spoken tutorial series is funded by the National Virtual Library of India, Ministry of Culture, Government of India.
Narration only This script and video for this tutorial was contributed by Pankaj Patil from IIT Bombay.

This is Nancy Varkey signing off. Thanks for joining.

Contributors and Content Editors

Nancyvarkey, Pankajpatil694, Pravin1389