use Email password in c# RRS feed

  • Question

  • User-84554084 posted

    Hello guys,

    I want to send email through code #c , how to secure the email password and not use it as clear text ?

    SmtpClient client = new SmtpClient();
    client.Port = 587;
    client.Host = "smtp.gmail.com";
    client.EnableSsl = true;
    client.Timeout = 10000;
    client.DeliveryMethod = SmtpDeliveryMethod.Network;
    client.UseDefaultCredentials = false;
    // the password written in clear text
    client.Credentials = new System.Net.NetworkCredential("user@gmail.com","password");

    I've seen sol like write the password in config file then encrypt it , my problem there that encrypt and decrypt is done through command Line , how to do this after publish the site ?

    Friday, March 15, 2019 2:28 PM