Click here to Skip to main content
15,888,984 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
How to send email in a way so there is no need to insert password? For now i am using something like this:
C#
MailMessage el = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
string na = "mail.mail@gmail.com";
el.From = new MailAddress(na);
el.To.Add(na);
// adding the file:
System.Net.Mail.Attachment p;
p = new System.Net.Mail.Attachment("...location of a file...");
ele.Attachments.Add(p);
// sending:
SmtpServer.Port = 587;
string eleP = "mail.mail@gmail.com";
string gE = "...password...";
SmtpServer.Credentials = new System.Net.NetworkCredential(eleP, gE);
SmtpServer.EnableSsl = true;
SmtpServer.Send(ele);

As you can see in this code there is a password to access the email, but i don't want that. Is there a way to solve this? I don't want to use someones .dll,... The best thing it would be to just ask users email address and that is it, or use another email provider that does not need for credentials, ext. Some simple solution.
Posted
Updated 28-Apr-13 12:37pm
v2
Comments
Mike Meinz 28-Apr-13 18:34pm    
I think you would have to run your own SMTP server. I believe all of the companies that offer email require passwords.
db7uk 28-Apr-13 19:08pm    
Mike is correct. Are you trying to setup a spam engine?
The only way is to have your own SMTP server. : http://local-smtp-server.en.softonic.com/, http://www.softstack.com/freesmtp.html or http://papercut.codeplex.com/. Not tried any and cant guarantee security or containing viruses but there are options out there if you search for them.
Member 4347041 29-Apr-13 2:31am    
I have an app that sends me users data for statistical purposes. From this code password can be extracted for email. If there is a way to hide/obfuscate,... this email and password, would also solve my problem.
tumbledDown2earth 30-Apr-13 2:01am    
Why cant you consider fetching the password from some other source (per user) like some storage. Alternatively you can also work on a federated authentication model where each user gets a callback before sending an email with their credentials
Member 4347041 30-Apr-13 2:39am    
I was thinking of putting two textboxes, one for users email and second for his password, but would you use that kind of an app that wants your password? You don't know what information app sends,... that's why i made one email, and put password into code, so user does not need to give his own.
It would solve my problem if noone could extract password from code. I am making only .exe app no need for setup,... only "copy/paste and use it".
I tried do obfuscate, but if string is between " and ", makes no change, it's still the same string. Also by getting this password, someone can change it, get into email and delete emails,...But i do need this approach, because i am also making statistical data, how my app is in use, what needs to be changed,...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900