mirror of
https://github.com/zitadel/zitadel.git
synced 2025-02-28 20:47:22 +00:00
fix(email): UTF-8 "Q" encode subject header (#6637)
fix(email): UTF-8 "Q" encode subject header
This commit is contained in:
parent
68bfab2fb3
commit
2e99d0fe1b
@ -54,7 +54,7 @@ func (msg *Email) GetContent() (string, error) {
|
||||
if !isHTML(msg.Content) {
|
||||
mime = "MIME-version: 1.0;" + lineBreak + "Content-Type: text/plain; charset=\"UTF-8\";" + lineBreak + lineBreak
|
||||
}
|
||||
subject := "Subject: " + msg.Subject + lineBreak
|
||||
subject := "Subject: " + qEncodeSubject(msg.Subject) + lineBreak
|
||||
message += subject + mime + lineBreak + msg.Content
|
||||
|
||||
return message, nil
|
||||
@ -67,3 +67,8 @@ func (msg *Email) GetTriggeringEvent() eventstore.Event {
|
||||
func isHTML(input string) bool {
|
||||
return isHTMLRgx.MatchString(input)
|
||||
}
|
||||
|
||||
// returns a RFC1342 "Q" encoded string to allow non-ascii characters
|
||||
func qEncodeSubject(subject string) string {
|
||||
return "=?utf-8?q?" + subject + "?="
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user