Using the System.Net.Mail.MailMessage
class I created an email. The email was in german and needed to contain the umlaut ü. For this reason I declared the SubjectEncoding
property of the object as Encoding.UTF8
.
On receiving the email I noticed that the ü had been subsituted by two specials character in one of three mail applications (GMX webmail). It worked in Office Outlook and the apple mail app.
When plugging the subject line from below into this decoder the problem is reproducible.
I started investigating and found the subject line in the meta data of the email.
Subject: =?utf-8?B?Qk9PVCBUZXN0OiBFcmZvbGdyZWljaGUgQW5tZWxkdW5nIGbD?=
=?utf-8?B?vHIgZGllIEJlcnVmc2Vya3VuZHVuZw==?=
The subject contains two parts which encode the first and second part of the header. Curiously the point where it split the subject in two is at the location of the ü.
I am now not quite sure who is at fault in this scenario. Is .Net incorrectly building the encoded subject line or is there an error in the webmail/decoder website? Is it just more or less strict interpretation of the RFC?