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

Conversion from MailMessage doesn't have TextParts #232

Closed
RoryStawart opened this issue Mar 4, 2016 · 1 comment
Closed

Conversion from MailMessage doesn't have TextParts #232

RoryStawart opened this issue Mar 4, 2016 · 1 comment
Labels
bug Something isn't working

Comments

@RoryStawart
Copy link

For a project that uses this, we build MailMessages and then send them out before logging them. For security, we need to replace a piece of text in the body with a useless string. The problem we faced is that the body parts were all MimePart, not the expected TextParts.

Our mail handler can accept a MailMessage which is converted using MimeMessage.CreateFromMailMessage, but when we go to work with the MimeMessage object in our logger, it only contains MimeParts under message.BodyParts (and likewise if we traverse the tree through message.Body).

The solution we found was to write the MimeMessage to a stream and then load a new object from the stream. This yields the expected TextParts that we are able to modify.

jstedfast added a commit that referenced this issue Mar 4, 2016
@jstedfast
Copy link
Owner

Thanks for the bug report!

@jstedfast jstedfast added the bug Something isn't working label Mar 4, 2016
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