mailer IS_TLS_ENABLED=true Gmail problem #5188

Closed
opened 2025-11-02 06:17:17 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @mariusrugan on GitHub (Apr 5, 2020).

  • Gitea version (or commit ref): 1.12.0+dev-89-gb264c3039 built with GNU Make 4.2.1, go1.14.1 : bindata, sqlite, sqlite_unlock_notify
  • Git version:
  • Operating system: Linux / latest docker image gitea/gitea
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

Mailer sends email via google only with IS_TLS_ENABLED=false, otherwise throws error:

Failed to send a testing email to 'example@gmail.com': gomail: could not send email 1: NewClient: tls: first record does not look like a TLS handshake

I'm using this configuration:

ENABLED        = true
HOST           = smtp.gmail.com:587
FROM           = example@gmail.com
USER           = example@gmail.com
PASSWD         = ***
MAILER_TYPE    = smtp
IS_TLS_ENABLED = false
HELO_HOSTNAME  = example.com

Not using Gsuite, just a simple gmail account.

Screenshots

Originally created by @mariusrugan on GitHub (Apr 5, 2020). <!-- NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue --> <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 1.12.0+dev-89-gb264c3039 built with GNU Make 4.2.1, go1.14.1 : bindata, sqlite, sqlite_unlock_notify - Git version: - Operating system: Linux / latest docker image gitea/gitea - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [x] No - [ ] Not relevant - Log gist: ## Description Mailer sends email via google **only with IS_TLS_ENABLED=false**, otherwise throws error: `Failed to send a testing email to 'example@gmail.com': gomail: could not send email 1: NewClient: tls: first record does not look like a TLS handshake ` I'm using this configuration: ``` ENABLED = true HOST = smtp.gmail.com:587 FROM = example@gmail.com USER = example@gmail.com PASSWD = *** MAILER_TYPE = smtp IS_TLS_ENABLED = false HELO_HOSTNAME = example.com ``` Not using Gsuite, just a simple gmail account. ## Screenshots <!-- **If this issue involves the Web Interface, please include a screenshot** -->
GiteaMirror added the type/question label 2025-11-02 06:17:17 -06:00
Author
Owner

@guillep2k commented on GitHub (Apr 6, 2020):

I think, you should be using port 465 instead of 587. As far as I recall 465 is TLS-only, but 587 is a cleartext SMTP port with STARTTLS support.

@guillep2k commented on GitHub (Apr 6, 2020): I think, you should be using port 465 instead of 587. As far as I recall 465 is TLS-only, but 587 is a cleartext SMTP port with STARTTLS support.
Author
Owner

@mariusrugan commented on GitHub (Apr 6, 2020):

Thanks @guillep2k !, works
i've switched port to 465 and IS_TLS_ENABLED=true

[mailer]
ENABLED        = true
HOST           = smtp.gmail.com:465
FROM           = example@gmail.com
USER           = example@gmail.com
PASSWD         = ***
MAILER_TYPE    = smtp
IS_TLS_ENABLED = true
HELO_HOSTNAME  = example.com

This config should make its way in docs, should i open a PR and tag you for approval ? (i'm a gitea noob)

@mariusrugan commented on GitHub (Apr 6, 2020): Thanks @guillep2k !, works i've switched port to `465` and `IS_TLS_ENABLED=true` ``` [mailer] ENABLED = true HOST = smtp.gmail.com:465 FROM = example@gmail.com USER = example@gmail.com PASSWD = *** MAILER_TYPE = smtp IS_TLS_ENABLED = true HELO_HOSTNAME = example.com ``` This config should make its way in docs, should i open a PR and tag you for approval ? (i'm a gitea noob)
Author
Owner

@zeripath commented on GitHub (Apr 6, 2020):

@mariusrugan feel free to suggest changes to #10995

@zeripath commented on GitHub (Apr 6, 2020): @mariusrugan feel free to suggest changes to #10995
Author
Owner

@Th3Whit3Wolf commented on GitHub (Jun 5, 2020):

So glad I found this! I am self hosting a mailcow instance on another server. The docs make it look like it should be using port 587 when as @guillep2k mentions it should be 465. Problem solved. Thank you guys!!

@Th3Whit3Wolf commented on GitHub (Jun 5, 2020): So glad I found this! I am self hosting a mailcow instance on another server. The docs make it look like it should be using port 587 when as @guillep2k mentions it should be 465. Problem solved. Thank you guys!!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#5188