Apr 8, 2022 08:30 AM
(This post was last modified: Apr 8, 2022 08:38 AM by Smoky.)
Hey Everyone,
I want to encode links on a mail body in a richTextBox, for that I created a method Encode64 and Decode64 that I put here :
Everything is fine.
My problem is that I would like the link to be decoded when I receive the mail.
I've been looking for a few days and I found this which, if I understand correctly, would do the job: https://stackoverflow.com/questions/7069...64-encoded
It says that you have to locate the HTML body part (I specify that I'm trying to work on plain text for the moment) and then, you have to define the Content-Transfer-Encoding parameter
I don't understand how and where to add this, is it in my MimeMessage class or rather BodyBuilder please?
When I try:
It gives me an error CS1501, could someone help me to understand how to make the link decode when I receive the email please?
I want to encode links on a mail body in a richTextBox, for that I created a method Encode64 and Decode64 that I put here :
Code
public string Encode64(string toEncode)
{
byte[] encode = ASCIIEncoding.ASCII.GetBytes(toEncode);
string returnValue = Convert.ToBase64String(encode);
return returnValue;
}
//Methode pour decoder Base64
public string Decode64(string toDecode)
{
byte[] decode = Convert.FromBase64String(toDecode);
string returnValue = ASCIIEncoding.ASCII.GetString(decode);
return returnValue;
}Everything is fine.
My problem is that I would like the link to be decoded when I receive the mail.
I've been looking for a few days and I found this which, if I understand correctly, would do the job: https://stackoverflow.com/questions/7069...64-encoded
It says that you have to locate the HTML body part (I specify that I'm trying to work on plain text for the moment) and then, you have to define the Content-Transfer-Encoding parameter
I don't understand how and where to add this, is it in my MimeMessage class or rather BodyBuilder please?
When I try:
Code
var text = mime.BodyParts.OfType<TextPart>(x => x.IsHtml).FirstOrDefault();It gives me an error CS1501, could someone help me to understand how to make the link decode when I receive the email please?

