Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Configure Seafile To Send Emails Through Gmail

You need to configure Seafile to be able to send emails in order to have new users sent their password via email, or for the user to recieve password reset notifications. This tutorial will show you how to configure Seafile to use your existing Gmail account in order to send emails. If you are a business with an AWS account, then you may wish to configure Seafile with SES SMTP instead.

Steps

The first thing you need to do is create an app-specific password in your gmail account. That way if your server becomes compromised and a malicious user manages to retrieve your password, you can remove that password from your account and not have to reconfigure the rest of your applications with new a password.

Now edit your configuration file at conf/seahub_settings.py and append the lines below. The conf folder will be on the same level as your seafile-server-latest symlink.

EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'username@gmail.com'
EMAIL_HOST_PASSWORD = 'my-app-specific-password'
EMAIL_PORT = 587
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
SERVER_EMAIL = EMAIL_HOST_USER

Make sure to change the values of EMAIL_HOST_USER and EMAIL_HOST_PASSWORD.

Restart Seahub

For the changes to take effect you need to run:

./seahub.sh stop
./seahub.sh start

To test that everything is working, execute a password reset. A pop-up will appear and tell you if it managed to send the email or if your configuration is incorrect.

References

Last updated: 2nd September 2018
First published: 16th August 2018

This blog is created by Stuart Page

I'm a freelance web developer and technology consultant based in Surrey, UK, with over 10 years experience in web development, DevOps, Linux Administration, and IT solutions.

Need support with your infrastructure or web services?

Get in touch