Can't send emails: socket.gaierror: [Errno -2] Name or service not known

How have you self-hosted Baserow.

I am using docker-compose file copied from gitlab (version 1.20.2)

Which version of Baserow are you using.

1.20.2

Describe the problem

This is part of env file for SMTP

EMAIL_SMTP=True
EMAIL_SMTP_HOST=mail.xn--80aaaadpz8f.xn--p1ai
EMAIL_SMTP_PORT=587
EMAIL_SMTP_USE_TLS=True
EMAIL_SMTP_USER=noreply@датабаза.рф
EMAIL_SMTP_PASSWORD="therewasmypass"

and this is dig for that mail

dig "mail.xn--80aaaadpz8f.xn--p1ai" MX

; <<>> DiG 9.16.1-Ubuntu <<>> mail.xn--80aaaadpz8f.xn--p1ai MX
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 33243
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;mail.датабаза.рф.      IN      MX

;; AUTHORITY SECTION:
датабаза.рф.    600     IN      SOA     ns1.reg.ru. hostmaster.ns1.reg.ru. 1723111753 14400 3600 604800 10800

;; Query time: 80 msec
;; SERVER: 172.24.144.1#53(172.24.144.1)
;; WHEN: Mon Aug 19 14:39:49 MSK 2024
;; MSG SIZE  rcvd: 104

Please attach full logs from all of Baserow’s services

baserow-celery-1  | [2024-08-19 11:05:00,166: INFO/MainProcess] Task djcelery_email_send_multiple[cae5011b-32a7-40d6-892b-cfb9ff031309] received
baserow-celery-1  | [2024-08-19 11:05:00,235: ERROR/ForkPoolWorker-2] djcelery_email_send_multiple[cae5011b-32a7-40d6-892b-cfb9ff031309]: Cannot reach CELERY_EMAIL_BACKEND django.core.mail.backends.smtp.EmailBackend
baserow-celery-1  | Traceback (most recent call last):
baserow-celery-1  |   File "/baserow/venv/lib/python3.9/site-packages/djcelery_email/tasks.py", line 40, in send_emails
baserow-celery-1  |     conn.open()
baserow-celery-1  |   File "/baserow/venv/lib/python3.9/site-packages/django/core/mail/backends/smtp.py", line 62, in open
baserow-celery-1  |     self.connection = self.connection_class(self.host, self.port, **connection_params)
baserow-celery-1  |   File "/usr/lib/python3.9/smtplib.py", line 253, in __init__
baserow-celery-1  |     (code, msg) = self.connect(host, port)
baserow-celery-1  |   File "/usr/lib/python3.9/smtplib.py", line 339, in connect
baserow-celery-1  |     self.sock = self._get_socket(host, port, self.timeout)
baserow-celery-1  |   File "/usr/lib/python3.9/smtplib.py", line 310, in _get_socket
baserow-celery-1  |     return socket.create_connection((host, port), timeout,
baserow-celery-1  |   File "/usr/lib/python3.9/socket.py", line 822, in create_connection
baserow-celery-1  |     for res in getaddrinfo(host, port, 0, SOCK_STREAM):
baserow-celery-1  |   File "/usr/lib/python3.9/socket.py", line 953, in getaddrinfo
baserow-celery-1  |     for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
baserow-celery-1  | socket.gaierror: [Errno -2] Name or service not known
baserow-celery-1  | [2024-08-19 11:05:00,283: WARNING/ForkPoolWorker-2] djcelery_email_send_multiple[cae5011b-32a7-40d6-892b-cfb9ff031309]: Failed to send email message to ['therewasmy@email.com'], retrying. (gaierror(-2, 'Name or service not known'))

I also tried other ports and provide FROM_EMAIL option, but it didn’t worked for me too.

It looks like the configured SMTP environment variables are incorrect and the SMTP host can’t be resolved. You would need to double-check if the EMAIL_SMTP_HOST can be reached from that server.

1 Like