and it worked. I was able to send email. Now, I’ve installed version 1.21.0 and I’m trying to configure the email. As HOST is being deprecated, I have this:
But, it doesn’t work! When I attempt to send a test email from the configuration page, I’m getting the error “could not initiate SMTP session: tls: first record does not look like a TLS handshake”.
The docs appear to be inconsistent. They list PROTOCOL = smtps in conjunction with SMTP _PORT = 587, but the submission daemon that listens on TCP 587 is normally configured for STARTTLS.
You might try setting PROTOCOL = starttls and see if that works. Alternately, you could switch to SMTP _PORT = 465 which uses implicit TLS.
Thanks for the reply. Unfortunately, I get authentication failed in both cases. The message is:
Failed to send a testing email to “xxx@somedomain.com”: gomail: could not send email 1: failed to authenticate SMTP: 535 5.7.8 Error: authentication failed:
When I looked at the log on the mail server, in both cases, the log entry is “SASL PLAIN authentication failed:”
And I doubled checked – the user name and password specified in the app.ini configuration file are correct.
Anyway, using the instructions in the link you provided, I was able to successfully connect and send test emails using both ports 465 and 587.
So the problem isn’t with making an email connection from the computer running Gitea. Which seems to bring us back to the problem being an issue with Gitea itself. (Hopefully it’s just a configuration issue and not some bug.)
FYI (and for anyone else reading this thread), the example statement on that link for connecting to port 465 is incorrect. It should just be:
openssl s_client -connect example.com:465
not as shown:
openssl s_client -starttls smtp -connect example.com:465
because for port 465 SSL is implicit.
Unfortunately, I’ve never been able to get Gitea to actually successfully send an email. So, what I have in my configuration for emails probably won’t help you any.
All that I’ve been able to do was to manually send an email using openssl s_client to demonstrate that the issue (as far as I can tell) is with Gitea, and not the mail server.
FYI, I’m still running 1.21.0. I haven’t upgraded to 1.21.4 yet.
Sorry that I am not able to really help you. If you do managed to get email to work, I would love to hear how you managed to do so.
Thank you tomekk. I was finally able to get email to work!
But, I did encounter a problem when the password contained certain special characters. A number of special characters are fine. But, when the password contained either a pound (#) or semicolon ( character, I got an authorization error.
I was specifying the password like this:
PASSWD = ‘password#’
Here’s a list of the specials characters that I’ve tried using and worked:
& ! _ ? = ( ) { } @ $
(I used the password generator from LastPass to generate a random password and specified to also include special characters.)
If anyone finds this page that’s trying to configure mail on Gitea or Forgejo with Postmark, then try the configuration I’m sharing. The problem that I had was that I couldn’t use port 587 on Akamai/Linode.
[mailer]
ENABLED = true
SMTP_ADDR = smtp.postmarkapp.com
SMTP_PORT = 2525
PROTOCOL = smtp+starttls
FROM = "Forgejo Admin" <git@myemailaddress.com>
USER = Server API token here
PASSWD = Server API token here as well