I am currently trying to get a debug mail up and running. The moment an error occurs it will send a mail with the error to the mail i use. But after letting somebody test it he actually got my mail password and mail out of it and decided to change the password.
public void Send() {
MailMessage MailMesaji = new MailMessage();
MailMesaji.Subject = "subject";
MailMesaji.Body = "mail body";
MailMesaji.From = "sender mail adress";
this.MailMesaji.To.Add(new MailAddress("to mail adress"));
System.Net.Mail.SmtpClient Smtp = new SmtpClient();
Smtp.Host = "smtp.gmail.com"; // for example gmail smtp server
Smtp.EnableSsl = true;
Smtp.Credentials = new System.Net.NetworkCredential("account name", "password");
Smtp.Send(MailMesaji);
}
So i was wondering, is it possible to encrypt the account name and password to prevent stealing ?
I am sorry if i did not search good enough, but could not find anything on how to encrypt email/password
As you need to recover the original password to use for the mail send, you would have to use some form reversible encryption.
It sounds like you are in a situation where you want to pass on your source code to another user to test. That tester will be able to simply breakpoint your code on the
new System.Net.NetworkCredentialline and see what is being passed to the constructor.So, however you manage to encrypt your credentials, if you are passing the code (or executable) to somebody else for testing, then they will be able to access your password.