Closed dlidstrom closed 2 years ago
I'm sending mails with non-english characters in the subject, and they end up being encoded as html:
test åäö ÅÄÖ
This is how the subject ends up looking.
My template looks like this:
@model Snittlistan.Web.Models.SendEmail To: @Model.To From: @Model.From @if (string.IsNullOrEmpty(Model.ReplyTo) == false) { @:Reply-To: @Model.ReplyTo } Bcc: @Model.Bcc Subject: @Model.Subject Content-Type: text/html; charset=utf-8 <html> <head> </head> <body> @Model.Content </body> </html>
Any idea on how to fix this? Should I specify the encoding in the subject?
Best way to solve a problem yourself is to first file an issue. This seems to work:
Subject: @(string.Format("=?utf-8?B?{0}?=", Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(Model.Subject))))
I'm sending mails with non-english characters in the subject, and they end up being encoded as html:
This is how the subject ends up looking.
My template looks like this:
Any idea on how to fix this? Should I specify the encoding in the subject?