Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Malformed subject after casting from MailMessage to MimeMessage #306

Closed
Sicos1977 opened this issue May 19, 2017 · 2 comments
Closed

Malformed subject after casting from MailMessage to MimeMessage #306

Sicos1977 opened this issue May 19, 2017 · 2 comments
Labels
bug Something isn't working

Comments

@Sicos1977
Copy link

Sicos1977 commented May 19, 2017

Hi,

I got some strange behavior when casting a MailMessage to a MimeMessage like this.

        public string WriteMessage(Email email, MailMessage message)
        {
            var mimeMessage = (MimeMessage) message;
            mimeMessage.Date = email.SendDate;
            return WriteMessage(mimeMessage);
        }

The subject gets UTF8 encoded,

image

When I open this message in Outlook the subject looks like this

image

At the moment I just fixed it like this
mimeMessage.Subject = message.Subject;

jstedfast added a commit that referenced this issue May 19, 2017
@jstedfast
Copy link
Owner

Is this after you sent the message via System.Net.Mail.SmtpClient?

I highly recommend avoiding this method. It will likely never be perfect - it's intent is only as a temporary solution for developers porting to MailKit, not intended as a real solution for production.

@jstedfast jstedfast added the bug Something isn't working label May 19, 2017
@Sicos1977
Copy link
Author

Well I just used it for the thing you mentioned... porting to MailKit. At the moment it was to much work to rewrite a lot of code and so I took the easy way.... casting :-).

But to answer your question. I had the problem before sending it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants