Any success with SMTP?

I’m wondering if anyone has been successful in setting SMTP for mail delivery. I’m running Gramps Web with Docker, but I can’t seem to get mail delivery to work. I tried setting on first run, but didn’t get any email delivery either for me or for the next couple users that signed up. I also tried setting environment variables in docker (prefixing each variable as recommended with GRAMPSWEB_), but this didn’t work either. I succeeded in accessing the sqlite User database with Adminer and I tried changing the SMTP settings to use Gmail SMTP instead of my own mail server’s SMTP, and I removed the docker environment variables to make sure they weren’t interfering, but still no luck. Are there any logs anywhere that could help detect where the problem may be? And has anyone been successful in setting SMTP? If so please share.

I’m wondering if anyone has been successful in setting SMTP for mail delivery

Yes … :roll_eyes:

Please share your configuration, with sensitive values redacted, otherwise we can’t help you.

Here is my configuration in sqlite users database, configuration table:

EMAIL_HOST = smtp.gmail.com
EMAIL_PORT = 587
EMAIL_HOST_USER = myuser@gmail.com
EMAIL_HOST_PASSWORD = mygmailuserpassword
DEFAULT_FROM_EMAIL = myuser@gmail.com
BASE_URL = https://gramps.mydomain.com/
1 Like

I tried checking current configuration via api but I receive an error response:

403 forbidden
You don't have the permission to access the requested resource. It is either read-protected or not readable by the server.

I can query other resources such as media, or importers, but there are a number of resources that give errors: tasks, objects, relations, living, timelines all give:

404 Not Found
The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.

Only config gives a 403 error.

All other resources (people,families,places,events etc.) are working fine.

I also tried creating the config.cfg volume on disk as indicated here, and setting the configuration that way. And I tried setting EMAIL_USE_TLS=False since I’m using port 587, and I read in the documentation:

When using STARTTLS, set this to False

Still no luck. No emails are sent when I try for example to start password recovery.

I have also tried using port 465, setting EMAIL_USE_TLS=True, however I’m still not getting an email when clicking on password reset.

Like the media import problem, this sounds like the task queue (which handles background tasks like sending e-mails or importing media files) is not picking up the configuration environment or volumes or both. Please share your docker-compose file with personal data redacted.

Please check the celery logs whether the sending of the e-mail shows up as a completed task or whether an error appears.

I have a similar issue. Where is the SMTP config edited?

Can the mail server settings be configured in the GUI?

I finally got SMTP to work using Gmail SMTP and an app password (after activating 2FA) rather than the account password! I also had to set the port to 465. I can’t seem to get port 587 to work; I tried adding this row to the sqlite configuration table:

| id |      key      | value |
|----|---------------|-------|
| 7  | EMAIL_USE_TLS | False |

I also tried:

| id |      key      | value |
|----|---------------|-------|
| 7  | EMAIL_USE_TLS |   0   |

Then I just gave up and set the port to 465 without an EMAIL_USE_TLS entry (can this value be set in the configuration table?)

1 Like

After downing the docker compose, removing volumes, and upping from scratch, the config resource seems to be working. I now get a response from postman :

{
    "BASE_URL": "https://gramps.mydomain.com",
    "DEFAULT_FROM_EMAIL": "myemail@gmail.com",
    "EMAIL_HOST": "smtp.gmail.com",
    "EMAIL_HOST_PASSWORD": "my_app_password",
    "EMAIL_HOST_USER": "myemail@gmail.com",
    "EMAIL_PORT": "465"
}

I attempted doing this on an implementation on a virtual Debian 12 server, and I still can’t get any emails sent (password reset or new user registration) via my gmail account. I had a little problem obtaining a Google app password since it is now buried on their site, but now the app password does not seem to work.

Updates or suggestions?

It sounds like you’re facing some challenges with SMTP in Gramps Web on Docker. Many users have had success using SMTPget for reliable mail delivery. It’s straightforward to set up and works well with various applications.

As for logs, you might want to check the Docker container logs for any error messages related to mail delivery. That could give you clues about what’s going wrong.

SMTP server configuration troubleshooting is a bit difficult because the settings aren’t easy to modify in Gramps Web. So I suggest verifying that you are able to use the app password in your favorite email program to make sure it works. If it does, then it’s a matter of ensuring all the settings are correctly stored in Gramps Web.

FYI, I am using Yahoo! SMTP service with an app password.

Try checking the Docker logs to see if there are any error messages. You might want to use services like SMTPmart or Mailgun instead of Gmail, as they often work better. Double-check your environment variables and make sure nothing is blocking the connection, like your server’s firewall or email settings. Hope this helps!

I use SMTP just fine. I would not recommend gmail; getting your
authentication exactly right is tricky. To be fair, I run gramps
web on a Linux-based host that I have complete access to, so I
can run anything I wish (for the most part). In my case, gramps
web uses the SMTP setup for the hosting environment which they
have nicely documented (dreamhost.com, if you’re interested).

Typically, Linux systems will store all sorts of log messages
in /var/log; mail info may be in /var/log/syslog (Debian-based),
/var/log/messages (Fedora-based) or in /var/log/mail*. That’s
where I would start looking.

If you’re using docker, there may be another container out there
somewhere that runs postfix, or msmtp (one of the most light-weight
mail agents), or something like those. It may be easier to connect
the containers (e.g., postfix in container A, gramps-web in container
B, pointing at A as mail agent), if you have no other access.

If you’re using an ISP, chances are they have SMTP set up and they
likely have an FAQ somewhere on authentication and ports to use. If
you use that info in gramps web, you may have better luck.

I went into my admin page for gramps web to see if I did anything
clever in the Mail and Registration section. Since I’m running SMTP
on the same host as gramps web, I do have SMTP authentication turned
off. That does simplify a lot of things.

Yes, SMTP setup can be tricky with Docker. Ensure correct environment variables and server settings. Check logs in the Docker container using `docker logs. For seamless email delivery, I recommend DigitalAka—I’ve used their services, and their SMTP integration is reliable, with great support.

Here are the results I get with smtp.gmail.com on 12/28/2024

port 587 use_tls=False, result is successful email
port 587 use_tls=True, result is SSLError
port 465 use_tls=False, result is timeout error
port 465 use_tls=True, result is successful email

I believe the default is EMAIL_USE_TLS = True in config.py, so port 587 will not work with data only from the web setup page, unless you override it with your own config.cfg file.