Question

I have a page in my website which users can send messages to website's admin. I use the Email address which server gave to me to send the message to myself. I don't have problem in coding but the thing that I'm concerned about, is the credential that I have to send to server like this:

System.Net.NetworkCredential myCredential = new System.Net.NetworkCredential("email", "password");
mySmtpClient.Credentials = myCredential;

I am sure that this will send these information in clear text. How I can secure this? can this following code secure everything independently?

smtpClient.EnableSsl = true;

these are some information that my server gave to me. should I use them?

Proxy Settings Exchange Online https://webmail.myserver.com (Port 443)
Principal name Exchange Online: msstd: webmail.myserver.com
Proxy authentication settings: Basic Authentication Webmail: webmail.myserver.com 

By the way is it secure to use my username and password directly on my aspx file? I mean can anybody reach these information?

Was it helpful?

Solution

The code file will be in clear text but the connection between your webserver and SMTP server will be secure if you use SSL. .NET will handle this for you if you (as you did) specify EnableSsl.

OTHER TIPS

Simon is right, if you use SSL .NET will handle this from your application to the email server. That said, you should make sure to encrypt this password through all over over the wire communication. If it's stored in a database (or transferred from a UI or something) it should be encrypted there and decrypted in your application.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top