Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

How to send in Mimekit an email with a base64 encoded link in the message body?

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 :

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?
saw your last thread, you got it fixxed or same Problem ?
(Oct 27, 2022 11:57 AM)m0rty. Wrote:  saw your last thread, you got it fixxed or same Problem ?

Yo M0rty
Yes, in fact, at the time, I did otherwise, if you want to see the work finished, I'll send it to you..
I also understood the way to encode in base64 then to add a reference to the project to be able to decode later, do you have a mailer project in progress?
(Oct 27, 2022 01:25 PM)Smoky Wrote:  Yo M0rty
Yes, in fact, at the time, I did otherwise, if you want to see the work finished, I'll send it to you..
I also understood the way to encode in base64 then to add a reference to the project to be able to decode later, do you have a mailer project in progress?

Hey thats nice! and thanks <3


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Source] by QismonNov 27, 2024 04:29 AM 2 304 Nov 27, 2024 04:29 AM
Last Post: mikeyp
[Shell] by SIM-4581439Apr 5, 2020 06:19 PM 0 171 Apr 5, 2020 06:19 PM
Last Post: SIM-4581439
[.NET] by NYANxCATMay 12, 2019 01:06 AM 3 456 May 12, 2019 01:06 AM
Last Post: NYANxCAT