Mailer errors with TLS when it shouldn't use it #2864

Closed
opened 2025-11-02 04:51:51 -06:00 by GiteaMirror · 5 comments
Owner

Originally created by @markusamshove on GitHub (Feb 5, 2019).

  • Gitea version (or commit ref): 1.7.1
  • Git version:
  • Operating system: SuSe Linux 12
  • Database (use [x]):
    • PostgreSQL
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:
2019/02/05 08:44:41 [...les/mailer/mailer.go:246 processMailQueue()] [E] Failed to send emails [some@mail]: Subject: [OutdatedTest] Test (#1), issue comment - gomail: could not send email 1: StartTLS: read tcp giteaip:31542->smtpip:25: read: connection reset by peer       

Description

I'm trying to set up the mailer to send mails to members on updates of PRs, but the mailer seems to fail.

I've made sure that the server Gitea is running on has the permissions to send mails via our mail server and I've confirmed that by sending mails via telnet from the Gitea server.

The error itself is strange, because I'm trying to not use any encryption.

app.ini:

[mailer]
ENABLED=true
FROM=...
HOST=smtpip:25
IS_TLS_ENABLED=false
MAILER_TYPE=smtp
Originally created by @markusamshove on GitHub (Feb 5, 2019). - Gitea version (or commit ref): 1.7.1 - Git version: - Operating system: SuSe Linux 12 - Database (use `[x]`): - [x] PostgreSQL - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant - Log gist: ``` 2019/02/05 08:44:41 [...les/mailer/mailer.go:246 processMailQueue()] [E] Failed to send emails [some@mail]: Subject: [OutdatedTest] Test (#1), issue comment - gomail: could not send email 1: StartTLS: read tcp giteaip:31542->smtpip:25: read: connection reset by peer ``` ## Description I'm trying to set up the mailer to send mails to members on updates of PRs, but the mailer seems to fail. I've made sure that the server Gitea is running on has the permissions to send mails via our mail server and I've confirmed that by sending mails via telnet from the Gitea server. The error itself is strange, because I'm trying to *not* use any encryption. app.ini: ``` [mailer] ENABLED=true FROM=... HOST=smtpip:25 IS_TLS_ENABLED=false MAILER_TYPE=smtp ```
GiteaMirror added the issue/confirmedissue/stale labels 2025-11-02 04:51:51 -06:00
Author
Owner

@d-Pixie commented on GitHub (Feb 6, 2019):

I think I remember seeing that Gitea will always use StartTLS, regardless of if the communication is then over TLS...

Yeah, if you look here https://docs.gitea.io/en-us/config-cheat-sheet/ under Mailer and SKIP_VERIFY it says Note: Gitea only supports SMTP with STARTTLS. so that is by design.

As for why, StartTLS is a call to upgrade to TLS if the server supports it. If you specify TLS on the other hand it means the server HAS to support it and negotiations will start out on that assumption. With StartTLS the server might only support plain text, might support SSL or might support TLS and the communication is negotiated depending on what the server replies. Read more here: https://en.wikipedia.org/wiki/Opportunistic_TLS

@d-Pixie commented on GitHub (Feb 6, 2019): I think I remember seeing that Gitea will always use `StartTLS`, regardless of if the communication is then over TLS... Yeah, if you look here https://docs.gitea.io/en-us/config-cheat-sheet/ under `Mailer` and `SKIP_VERIFY` it says `Note: Gitea only supports SMTP with STARTTLS.` so that is by design. As for why, StartTLS is a call to upgrade to TLS if the server supports it. If you specify TLS on the other hand it means the server HAS to support it and negotiations will start out on that assumption. With StartTLS the server might only support plain text, might support SSL or might support TLS and the communication is negotiated depending on what the server replies. Read more here: https://en.wikipedia.org/wiki/Opportunistic_TLS
Author
Owner

@stale[bot] commented on GitHub (Apr 8, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (Apr 8, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Author
Owner

@stale[bot] commented on GitHub (Apr 22, 2019):

This issue has been automatically closed because of inactivity. You can re-open it if needed.

@stale[bot] commented on GitHub (Apr 22, 2019): This issue has been automatically closed because of inactivity. You can re-open it if needed.
Author
Owner

@andreymal commented on GitHub (Aug 21, 2019):

@‍stale I have the same problem

@d-Pixie @MarkusAmshove @lunny plz reopen?

@andreymal commented on GitHub (Aug 21, 2019): **@‍stale** I have the same problem @d-Pixie @MarkusAmshove @lunny plz reopen?
Author
Owner

@markusamshove commented on GitHub (Aug 21, 2019):

I can't seem to reopen

@markusamshove commented on GitHub (Aug 21, 2019): I can't seem to reopen
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#2864