-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Fix sending mail with a non-latin display name. #2102 #2559
Conversation
Signed-off-by: Rémi Saurel <contact@remi-saurel.com>
Codecov Report
@@ Coverage Diff @@
## master #2559 +/- ##
=======================================
Coverage 26.99% 26.99%
=======================================
Files 85 85
Lines 17097 17097
=======================================
Hits 4615 4615
Misses 11807 11807
Partials 675 675
Continue to review full report at Codecov.
|
modules/mailer/mailer.go
Outdated
@@ -58,7 +58,7 @@ func NewMessageFrom(to []string, from, subject, body string) *Message { | |||
|
|||
// NewMessage creates new mail message object with default From header. | |||
func NewMessage(to []string, subject, body string) *Message { | |||
return NewMessageFrom(to, setting.MailService.From, subject, body) | |||
return NewMessageFrom(to, setting.MailService.From, "", subject, body) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But as stated in https://github.com/go-gitea/gitea/blob/master/conf/app.ini#L312 From can be in format "Sender" <sender@domain.ext>
so it should be parsed somehow and passed in both arguments
@lafriks OK, I overlooked this part. But parsing must also be done here too: https://github.com/go-gitea/gitea/pull/2559/files#diff-91afb18937651f768645eff6cf5779a8R169 and keeping only the address part. I will look into this. EDIT Nevermind, the place I pointed uses |
@rems4e it actually already parses it here: so probably new type field needs to be added |
@lafriks Yes, see my edit above, it was my mistake and I managed to follow the track too ^^ |
… `name <email@address>` format. #2102 Signed-off-by: Rémi Saurel <contact@remi-saurel.com>
This time it should be cleaner. |
LGTM |
LGTM |
Any chance of getting this backported to 1.2.x? |
seems it's not difficult. |
Signed-off-by: Rémi Saurel contact@remi-saurel.com
This pull request fixes #2102, where display name of email addresses containing non-latin characters cannot be used in the From: field when creating/updating issues (resulting in no email sent at all).
The fix is simple, it uses
Message.SetAddressHeader
, instead ofMessage.SetHeader
with a custom-formattedDisplayName <email@address>
from address.