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

Author

Programster

Stuart is a software developer with a passion for Linux and open source projects.

comments powered by Disqus
We are a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for us to earn fees by linking to Amazon.com and affiliated sites. More info.