简体   繁体   中英

How to send a Secure e-mail using SMTP

I am currently using Google Apps to send SMTP e-mails. If my project deploys some of the information that i am going to be sending will be confidential and i would like to make sure the transmission is secure. Can anyone please let me know what i need to do to ensure that i send a safe e-mail using smtp through the google apps smtp server? smtp.google.com.

Any help greatly appreciated.

From what I have been told i need to force Https and have a SSL cert in order to do this. I don't know if this is true?

You Can Use 'smtp.EnableSsl = true' For Enable SSL for security.

MailMessage mail = new MailMessage();
            mail.To.Add("" + to + "");
            mail.From = new MailAddress("" + from + "");
            mail.Subject = "Email using Gmail";
            string Body = "Hi, this mail is to test sending mail" +
                          "";
            mail.Body = Body;
            mail.IsBodyHtml = true;
            Attachment at = new Attachment(Server.MapPath("~/ExcelFile/TestCSV.csv"));
            mail.Attachments.Add(at);
            mail.Priority = MailPriority.High;
            SmtpClient smtp = new SmtpClient();
            smtp.Host = "smtp.gmail.com"; //Or Your SMTP Server Address
            smtp.Credentials = new System.Net.NetworkCredential(""+ username +"", ""+ password +"");
            smtp.EnableSsl = true;
            smtp.Port = 587;
            smtp.Send(mail);

To enforce Network Security you have to use SSL. to enforce security of the data going from your webserver to mail server you need to send your mail over SSL. and to secure the HTTP request that triggers the mail action you need to enforce SSL over HTTP.

But the question is Security in what context ? If you need network security to ensure a 3rd party cannot eavesdrop or manipulate then SSL is your way to go.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM