mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 06:57:33 +00:00
fix(email): UTF-8 "Q" encode subject header (#6637)
fix(email): UTF-8 "Q" encode subject header
This commit is contained in:
@@ -54,7 +54,7 @@ func (msg *Email) GetContent() (string, error) {
|
|||||||
if !isHTML(msg.Content) {
|
if !isHTML(msg.Content) {
|
||||||
mime = "MIME-version: 1.0;" + lineBreak + "Content-Type: text/plain; charset=\"UTF-8\";" + lineBreak + lineBreak
|
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
|
message += subject + mime + lineBreak + msg.Content
|
||||||
|
|
||||||
return message, nil
|
return message, nil
|
||||||
@@ -67,3 +67,8 @@ func (msg *Email) GetTriggeringEvent() eventstore.Event {
|
|||||||
func isHTML(input string) bool {
|
func isHTML(input string) bool {
|
||||||
return isHTMLRgx.MatchString(input)
|
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 + "?="
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user