Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accented letters are not accepted in mailer.FROM #2188

Closed
2 of 7 tasks
edgar-bonet opened this issue Jul 21, 2017 · 4 comments
Closed
2 of 7 tasks

Accented letters are not accepted in mailer.FROM #2188

edgar-bonet opened this issue Jul 21, 2017 · 4 comments
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/bug

Comments

@edgar-bonet
Copy link

  • Gitea version (or commit ref): 1.1.2
  • Git version: 2.7.4
  • Operating system: Ubuntu 16.04.2 LTS
  • 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

I tried to activate gitea's mailer by putting the following in custom/conf/app.ini:

[mailer]
ENABLED      = true
FROM         = Néel Institut git hosting service <git@***>
USE_SENDMAIL = true

When I clicked on the "Send Test Email" button, I got the error message: Impossible d'envoyer un e-mail de test à 'bonet@grenoble.cnrs.fr': gomail: could not send email 1: gomail: invalid address "=?UTF-8?q?N=C3=A9el_Institut_git_hosting_service_?=": mail: unclosed angle-addr.

I then replaced "Néel" by "Neel" and everything worked fine, thus I assume this is a problem with gitea (or gomail) mishandling the accented letter "é" (= U+00E9, Latin small letter e with acute).

It should be noted that "=?UTF-8?q?N=C3=A9el_Institut_git_hosting_service_?=" is the proper way to encode "Néel Institut git hosting service " in an e-mail header, as per RFC 2047. Thus, it looks like gomail genuinely attempts to support non-ASCII characters in the e-mail From field.

@lunny lunny added the type/bug label Jul 21, 2017
@lunny lunny added this to the 1.x.x milestone Jul 21, 2017
@scr34m
Copy link
Contributor

scr34m commented Aug 20, 2017

This is a gomail problem, but there is a workaround, but this problem occurs too when user name contains any non ASCII character.

type mimeEncoder struct {
	mime.WordEncoder
}

bEncoding := mimeEncoder{mime.BEncoding}
name := bEncoding.Encode("utf-8", "József Galamb")

msg := NewMessageFrom([]string{name + " <jon@example.org>"}, "jon@example.org", "subject", "body")

If this solution is okay then i could create a PR:

  • models/mail.composeIssueCommentMessage for comments notification
  • setting.MailService.From any where is used
    or simply make a check inside (more general solution) modules/mailer.NewMessageFrom() to field "to" and "from" an parse supplied values with https://golang.org/pkg/net/mail/#ParseAddress

@stale
Copy link

stale bot commented Feb 13, 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 stale bot added the issue/stale label Feb 13, 2019
@stale
Copy link

stale bot commented Feb 27, 2019

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

@stale stale bot closed this as completed Feb 27, 2019
@lunny lunny added issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented and removed issue/stale labels Feb 28, 2019
@lunny lunny reopened this Feb 28, 2019
@zeripath
Copy link
Contributor

This was fixed by #2559

@lafriks lafriks removed this from the 1.x.x milestone Jun 20, 2019
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/bug
Projects
None yet
Development

No branches or pull requests

5 participants