Camouflage Sender using Smtpclient

Asked

Viewed 38 times

-1

Eae you guys, beauty?

I am making a very simple email Nder, but I found myself in a question that I can not solve...

My first idea was to get a temporary email address to use as a Sender... But after some research I discovered that it is impossible to do this... (If it’s possible give me a light please)

So I decided to simply camouflage the email so the recipient can’t see who actually sent the email.

In the image shows the email there network credentials, wanted to mask this guy...

Ali mostra o email lá do network credentials, queria mascarar esse cara...

My code:

const string EMAIL = "";
        const string PASS = "";
        const string HOST = "smtp.gmail.com";
        const int PORT = 587;

        public static bool sendMail(string mailDestine, string mailDestineDisplay, string mailSend, string mailSendDisplay, string title, string body) {
            SmtpClient client = configureClient();

            MailMessage mail = new MailMessage();
            try {
                mail.IsBodyHtml=true;
                mail.Priority=MailPriority.High;

                mail.Sender = new MailAddress(mailSend, mailSendDisplay);
                mail.From = new MailAddress(mailSend, mailSendDisplay);
                mail.To.Add(new MailAddress(mailDestine, mailDestineDisplay));
                mail.Subject = title;
                mail.Body = body;
                client.Send(mail);
                Console.WriteLine("SUCESS, MAIL SEND...");
                return true;
            } catch {
                Console.WriteLine("ERROR...");
                return false;
            } finally {
                mail.Dispose();
            }
        }

        private static SmtpClient configureClient() {
            SmtpClient client = new SmtpClient();
            client.Host = HOST;
            client.EnableSsl = true;
            client.UseDefaultCredentials = false;
            client.Credentials = new NetworkCredential(EMAIL,PASS);
            client.Port = PORT;
            return client;
        }
  • do not waste time with it... create a no-reply account...

  • With that does not fall into the spam box?

1 answer

2


Just change the From

mail.From = new MailAddress("[email protected]", "Qualquer coisa");

Note that it is very likely that both the outgoing SMTP server (the one you use to send the email) and the incoming server (the recipient’s) will take steps to prevent this from being used to mislead the user. Therefore, the most you will be able to do is change the display name.

  • I switched to from already, but... When I received the email, I opened and clicked on displayname (Equal ta in print) and that email is one of stmp credentials...

  • @Marccuszavadzki because that’s what I said in the answer. Servers must have some policies to not allow this. If you don’t already have something in the upload library implementation itself.

  • Ahh understood man, I believe I have to set up a local STMP and then climb it somewhere... So I think it’s good to do what I need, Thank you!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.