mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-11 04:05:10 +02:00
[PORT] Use FullName in Emails to address the recipient if possible (gitea#31527) (#4516)
Before we had just the plain mail address as recipient. But now we provide additional Information for the Mail clients. --- Porting information: - Two behavior changes are noted with this patch, the display name is now always quoted although in some scenarios unnecessary it's a safety precaution of Go. B encoding is used when certain characters are present as they aren't 'legal' to be used as a display name and Q encoding would still show them and B encoding needs to be used, this is now done by Go's `address.String()`. - Update and add new unit tests. Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4516 Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org> Co-authored-by: Gusted <postmaster@gusted.xyz> Co-committed-by: Gusted <postmaster@gusted.xyz>
This commit is contained in:
parent
3c8cd43fec
commit
8a1924b51a
5 changed files with 67 additions and 13 deletions
|
@ -82,7 +82,7 @@ func sendUserMail(language string, u *user_model.User, tpl base.TplName, code, s
|
|||
return
|
||||
}
|
||||
|
||||
msg := NewMessage(u.Email, subject, content.String())
|
||||
msg := NewMessage(u.EmailTo(), subject, content.String())
|
||||
msg.Info = fmt.Sprintf("UID: %d, %s", u.ID, info)
|
||||
|
||||
SendAsync(msg)
|
||||
|
@ -158,7 +158,7 @@ func SendRegisterNotifyMail(u *user_model.User) {
|
|||
return
|
||||
}
|
||||
|
||||
msg := NewMessage(u.Email, locale.TrString("mail.register_notify", setting.AppName), content.String())
|
||||
msg := NewMessage(u.EmailTo(), locale.TrString("mail.register_notify", setting.AppName), content.String())
|
||||
msg.Info = fmt.Sprintf("UID: %d, registration notify", u.ID)
|
||||
|
||||
SendAsync(msg)
|
||||
|
@ -189,7 +189,7 @@ func SendCollaboratorMail(u, doer *user_model.User, repo *repo_model.Repository)
|
|||
return
|
||||
}
|
||||
|
||||
msg := NewMessage(u.Email, subject, content.String())
|
||||
msg := NewMessage(u.EmailTo(), subject, content.String())
|
||||
msg.Info = fmt.Sprintf("UID: %d, add collaborator", u.ID)
|
||||
|
||||
SendAsync(msg)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue