Send email using Fastmail

I am running gitea on an LXC container in Proxmox. I am trying to setup email integration with Fastmail, but I am receiving an error when I try to send a test email:

Failed to send a testing email to “xxxx”: gomail: could not send email 1: failed to establish network connection to SMTP server: dial tcp: lookup smtp.fastmail.com : no such host

I am using the following configuration on my app.ini file:

[mailer]
ENABLED = true
SMTP_ADDR = "smtp.fastmail.com "
SMTP_PORT = 587
FROM = xxxx
USER = “xxxx”
PASSWD = app.password

According to the Fastmail help, this should work.

www.fastmail.help/hc/en-us/articles/1500000278342-Server-names-and-ports

I would appreciate any help or hint.

Thanks in advance

Have you checked DNS resolution inside your container?

Yes. I did. If I ping smtp.fastmail.com on the container it works.

That was also my first idea!

I have solved it. It was really stupid!

There was an space after the SMTP server address:

SMTP_ADDR = "hostname "

Removing the space solved the issue.

SMTP_ADDR = “hostname”

1 Like