Error gomail: could not send email 1: Auth: 535 5.7.8 Error: authentication failed: while sending SMTP mails #1458

Closed
opened 2025-11-02 04:01:30 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @marove2000 on GitHub (Jan 16, 2018).

  • Gitea version (or commit ref): d29aa76
  • Git version: 2.15.1
  • Operating system: Arch Linux
  • 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

When trying to activate sending mail via SMTP with the following configuration:

[mailer]
ENABLED = true
HOST = mail.host.com:587
FROM = no-reply@host.com
USER = no-reply@host.com
PASSWD = $password#

I get the error: gomail: could not send email 1: Auth: 535 5.7.8 Error: authentication failed:

Solution

I have special characters in the SMTP password ($ and #). Quoting the password:

PASSWD = `#password$`

was the solution.

I just want to post the solution if anybody has the same issue. Also I would ask if this should be documented in the app.ini documentation. I can imagine that similar errors can occur with the database-password.

Originally created by @marove2000 on GitHub (Jan 16, 2018). <!-- 1. Please speak English, this is the language all of us can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/NsatcWJ) 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): d29aa76 - Git version: 2.15.1 - Operating system: Arch Linux - Database (use `[x]`): - [ ] PostgreSQL - [x] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant - Log gist: ## Description When trying to activate sending mail via SMTP with the following configuration: [mailer] ENABLED = true HOST = mail.host.com:587 FROM = no-reply@host.com USER = no-reply@host.com PASSWD = `$password#` I get the error: gomail: could not send email 1: Auth: 535 5.7.8 Error: authentication failed: ## Solution I have special characters in the SMTP password ($ and #). Quoting the password: ``` PASSWD = `#password$` ``` was the solution. I just want to post the solution if anybody has the same issue. Also I would ask if this should be documented in the app.ini documentation. I can imagine that similar errors can occur with the database-password.
GiteaMirror added the type/docs label 2025-11-02 04:01:30 -06:00
Author
Owner

@lafriks commented on GitHub (Jan 16, 2018):

That would be good to document that in configuration cheatsheet and/or app.ini.sample

@lafriks commented on GitHub (Jan 16, 2018): That would be good to document that in configuration cheatsheet and/or app.ini.sample
Author
Owner

@marove2000 commented on GitHub (Jan 19, 2018):

I've made a pull request addressing this issue in sample.app.ini and it's documentation.

@marove2000 commented on GitHub (Jan 19, 2018): I've made a pull request addressing this issue in sample.app.ini and it's documentation.
Author
Owner

@techknowlogick commented on GitHub (Jun 27, 2018):

Closing this as documentation has been merged. Thanks @marove2000 😄

@techknowlogick commented on GitHub (Jun 27, 2018): Closing this as documentation has been merged. Thanks @marove2000 😄
Author
Owner

@ascandella commented on GitHub (Aug 31, 2018):

I just ran into this myself, except I never edited the config app.ini manually, it was done during the setup phase. It seems that (in install.go) we should write out a value surrounded by backticks to prevent this.

The simplest change would just be to backtick-surround mailer.PASSWD, but that strikes me as a band-aid. Perhaps the install code should be modified to use some helper that detects special characters (wrapping SetValue()) and auto-wraps them.

I'm happy to put together a PR and test if that sounds sane.

@ascandella commented on GitHub (Aug 31, 2018): I just ran into this myself, except I never edited the config app.ini manually, it was done during the setup phase. It seems that (in `install.go`) we should write out a value surrounded by backticks to prevent this. The simplest change would just be to backtick-surround mailer.PASSWD, but that strikes me as a band-aid. Perhaps the install code should be modified to use some helper that detects special characters (wrapping `SetValue()`) and auto-wraps them. I'm happy to put together a PR and test if that sounds sane.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#1458