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.
Steps
Enter the seafile container:
docker exec -it seafile /bin/bash
and edit the seahub_settings.py file:
vim /opt/seafile/conf/seahub_settings.py
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="seafile-admin@mydomain.com"
SERVER_EMAIL="seafile-admin@mydomain.com"
Then just exit out of the container and you're done.
exit
Persistant State / Volumes
Don't worry about losing this configuration if your containers were to be destroyed. The configuration file is within:
/opt/seafile/conf/...
... and that conf folder is actually a symlink to:
/shared/seafile/conf/
... 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.
AWS SMTP
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.
Gmail SMTP
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.
References
- https://forum.seafile.com/t/seafile-in-docker-email-in-docker-cannot-send-emails/6341
First published: 22nd February 2021