When i send mails with .NET SmtpClient, i have noticed the content transfer encoding is set to base64 when i check the source code of the mail.
I need to set it to Quoted-printable.How can i achieve this ?Thanks in advance
3 Answers
Because you are setting your message.BodyEncoding
to System.Text.Encoding.UTF8
, the transfer encoding is automatically set to Base64. (source in remarks section)
Depending on the reason why you need to have Quoted-printable transfer encoding, you will need to adjust your MailMessage
object accordingly to have the transfer encoding set to Quoted-printable.
More reading can be done here
Transfer Encoding Base64
When using .NET 4.5 or better, it should be possible to use
See https://docs.microsoft.com/en-us/dotnet/api/system.net.mail.mailmessage.bodytransferencoding?view=netframework-4.5
Not the answer you're looking for? Browse other questions tagged c#.netsmtpclient or ask your own question.
-->Applies to: Exchange Server 2013
Content transfer encoding defines encoding methods for transforming binary email message data into the US-ASCII plain text format. This transformation allows the message to travel through older SMTP messaging servers that only support messages in US-ASCII text. Content transfer encoding is defined in RFC 2045. The transfer encoding method is stored in the Content-Transfer-Encoding header field in the message. In Microsoft Exchange Server 2013, the following content transfer encoding methods are available:
7-bit: This value indicates that the message body data is already in the US ASCII plain text format, and no message encoding has been done to the message.
Quoted-printable (QP): This encoding method uses printable US-ASCII characters to encode the message body data. If the original message text is mostly US-ASCII text, QP encoding gives somewhat readable and compact results. By default, Exchange 2013 uses QP for encoding binary message data.
Base64: This encoding method is based primarily on the privacy-enhanced mail (PEM) standard defined in RFC 1421. Base64 encoding uses the 64-character alphabet encoding method and output padding characters defined by PEM to encode the message body data. Base64 encoding creates a predictable increase in message size and is optimal for binary data and non-US-ASCII text.
You configure the transfer encoding method using the ByteEncoderTypeFor7BitCharsets parameter on the Set-OrganizationConfig and Set-RemoteDomain cmdlets. The content transfer encoding settings you configure with Set-OrganizationConfig apply to all messages in the Exchange organization. The content transfer encoding settings you configure with Set-RemoteDomain apply only to message sent to external recipients in the remote domain.
The following table lists the values that you can use to set the transfer encoding method.
For more details about Content-Transfer-Encoding header field, see the 'Understanding the structure of email messages' section in Content conversion.
For more information about remote domains, see Remote domains.
What do you need to know before you begin?
Estimated time to complete: 15 minutes
You need to be assigned permissions before you can perform this procedure or procedures. To see what permissions you need, see the 'Transport service' entry in the Mail flow permissions topic.
For information about keyboard shortcuts that may apply to the procedures in this topic, see Keyboard shortcuts in the Exchange admin center.
Tip
Arc welder chrome extension download. For example, it is 'cfhdojbkjhnklbpkdaibdccddilifddb' for following link. You would need to follow above steps only if you specifically need the.CRX file). I found a solution based on the best solution in this forum post: To summarize, the solution is: • Go to where the extension is installed in your computer • Create a.crx file yourself • Drag & Drop the crx file into Chrome to install To be precise: • Find the ID of the extension you’re interested in at the end of the path from Chrome Web Store (the last groups of weird characters).
Having problems? Ask for help in the Exchange forums. Visit the forums at Exchange Server.
Use the Shell to configure the content transfer encoding method for the organization
To configure the content transfer encoding method for the organization, run the following command:
For example, to set the content transfer encoding method to Base64, run the following command:
Use the Shell to configure the content transfer encoding method for a remote domain
To configure the content transfer encoding method for all the recipients in a remote domain, run the following command:
For example, to set the content transfer encoding method to Base64, run the following command:
How do you know this worked?
To verify that you have successfully configured the method for content transfer encoding, do the following:
Send a test message that contains a mixture of US-ASCII text and binary data or non-US-ASCII text to an internal or external test account. Use an internal account to test organization settings, and an external account in the remote domain to test remote domain settings.
In an email client, view the Content-Transfer-Encoding header field in the message, and verify the content transfer encoding method that was used on the message matches the method you configured.