Configure Email (SMTP) For Seafile Deployed Through Docker
Previously, we deployed Seafile through docker. Now we need to figure out how to configure it with SMTP.
Enter the seafile container:
docker exec -it seafile /bin/bash
and edit the seahub_settings.py file:
Add your settings to the end of the file. E.g.
EMAIL_USE_TLS=True EMAIL_HOST="email-smtp.eu-west-2.amazonaws.com" EMAIL_HOST_USER="AKIAXXXXXXXXXX" EMAIL_HOST_PASSWORD="xxxxxxxxxxxxxxxxxxxx" EMAIL_PORT=587 DEFAULT_FROM_EMAIL="email@example.com" SERVER_EMAIL="firstname.lastname@example.org"
Then just exit out of the container and you're done.
Persistant State / Volumes
Don't worry about losing this configuration if your containers were to be destroyed. The configuration file is within:
... and that conf folder is actually a symlink to:
... and everything under shared is stored in a docker volume from our composer config during deployment, so all settings will be kept persistent in a volume across container lifetimes.
If you wish to use AWS SES for your SMTP provider, you may wish to create a policy that will only allow emails from your server's specific IP.
If you wish to use Gmail for SMTP, you may wish to refer to Configure Seafile To Send Emails Through Gmail, and Gmail - App Specific Passwords.
First published: 22nd February 2021