MailMessage.Encrypt, problems with german umlauts like äöü

0 votes
asked 4 days ago by AlexG (120 points)
edited 4 days ago by AlexG

Hello,

we use Rebex Secure Mail to send encrypted html emails. If the email contains german umlauts (like äöü), they will not be displayed correctly in OWA (Outlook Web Access).

The encoding ist set to utf-8, the html body is:

<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <title></title>
  </head>
  <body>
    <h2>HTML mail with german umlauts</h2>
    <div>äöüßÄÜÖ</div>
    <br/>
    <span>Mit freundlichen Grüßen</span>
  </body>
</html>

The following picture shows the difference between Outlook and OWA:

Mail

Some example how we create an send the email:

var mimeMessage = new MailMessage();
mimeMessage.BodyHtml = "some html text";
mimeMessage.DefaultCharset = System.Text.Encoding.UTF8;
mimeMessage.Encrypt(receiverCertificates);

Smtp.Send(mimeMessage, config);

So my question:
Did we forget something or is this a bug in Outlook Web Access ?

Applies to: Rebex Secure Mail

1 Answer

0 votes
answered 4 days ago by Lukas Pokorny (123,150 points)
edited 2 hours ago by Lukas Pokorny

I guess that a problem in the e-mail message such as a mismatch between MIME entity's charset and HTML charset is more likely to be a cause than a bug in Outlook Web Access. How do you actually construct the message? Do you assign the HTML text via MailMessage.BodyHtml, or via MailMessage.Views?

One random tip that might help - try setting the default charset to UTF-8:

var mail = new MailMessage();
mail.DefaultCharset = System.Text.Encoding.UTF8;
mail.BodyHtml = "some html text";
mail.Encrypt(...);
commented 4 days ago by AlexG (120 points)
Thank you for your response. Ive updated my question with an example how we create an send the email.
commented 3 days ago by Lukas Pokorny (123,150 points)
Does this problem occur with unencrypted messages as well, if they are otherwise constructed in the same way, just without the Encrypt method call?
commented 3 days ago by AlexG (120 points)
The problem does not occur if i comment out the Encrypt method call.
commented 3 days ago by Lukas Pokorny (123,150 points)
Thanks! In that case, it looks like either there is a bug related to the Encrypt method, or it's really a server-side issue. We'll look into this!
commented 2 hours ago by Lukas Pokorny (123,150 points)
The DefaultCharset property must be assigned before BodyHtml/BodyText, so please try swapping them:

var mimeMessage = new MailMessage();
mimeMessage.DefaultCharset = System.Text.Encoding.UTF8;
mimeMessage.BodyHtml = "some html text";
mimeMessage.Encrypt(receiverCertificates);

Smtp.Send(mimeMessage, config);
...