go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
44.12k stars 5.41k forks source link

SMTP configuration mismatch between Gitea and Postmark #27085

Open ghost opened 1 year ago

ghost commented 1 year ago

Description

Issue: When trying to configure Gitea to send mail via a Postmark SMTP server, the system is unable to send emails, the test end point in /admin/config does not even complete with an error - it simply spends forever trying to complete.

Details: I've taken a number of steps to narrow this down. If I configure Gitea to any other SMTP server, I manage to get it working without too much trouble. If I use other ways of testing the Postmark SMTP server, it too manages to work. It's only when I put the two together that I get the broken behavior.

There are two methods of setting up an SMTP server with Postmark. One uses the API token for a Postmark server as both the user and password of the SMTP configuration. The other generates a special "access key" / "secret key" for a particular message stream. Through experimentation I found that only the first method is broken. (And again, it is only broken when I put it together with Gitea - the first method works just fine when tested in any other way).

I took a look at the debug log after trying to run the test email and this is the last line in the log

2023/09/14 22:11:27 ...eb/routing/logger.go:68:func1() [W] router: slow      POST /admin/config/test_mail for ***.***.***.***:0, elapsed 3847.4ms @ admin/config.go:30(admin.SendTestMail)

The page itself simply goes into a never ending loading state.

Gitea Version

1.20.3

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

I am running Gitea from the binary installation instructions on an Ubuntu on systemd. No docker. Ubuntu version 22.04.2

Database

SQLite

techknowlogick commented 1 year ago

Without leaking any of your credentials, could you share your mailer config for postmark?

ghost commented 1 year ago

Yes. I've tried a few different configurations - all that seem like they should work when I test postmark other ways.

[mailer]
ENABLED = true
PROTOCOL = smtp+starttls
SMTP_ADDR = smtp.postmarkapp.com
SMTP_PORT = 25
USER = *** Server API-Token ***
PASSWD = *** Server API-Token ***
FROM = git@mydomain.com

I have tried with smtp and with smtp+starttls and I have tried with port 25 and port 587. All had the same behavior.