Click here to Skip to main content
15,893,381 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hj, i want send mail with gmail that "mail from" different "email account used send" :
Example:

C#
MailMessage mail = new MailMessage(); 
mail.Subject = "Subject"; 
mail.Body = "Main body goes here";

mail.From = new System.Net.Mail.MailAddress("my_email@gmail.com","My Name"); 
mail.IsBodyHtml = false; 
mail.BodyEncoding = System.Text.Encoding.Unicode; 
mail.SubjectEncoding = System.Text.Encoding.Unicode;
 
mail.To.Add("mailto@yahoo.com");
 
NetworkCredential cred = new NetworkCredential(
"mail_using_send@gmail.com", //from email address of the sending account
"password"); //password of the sending account
 
SmtpClient smtp = new SmtpClient("smtp.gmail.com"); 
smtp.UseDefaultCredentials = false; 
smtp.EnableSsl = true;
 
smtp.Credentials = cred;  
smtp.Port = 587;
 
smtp.Send(mail);


I using email "my_email@gmail.com" to make mail from that who recipient email can reply to "my_email@gmail.com". But when i test reply , mail reply still is "mail_using_send@gmail.com". I want mail reply is "my_email@gmail.com". How can make it? Thanks advance :)
Posted
Updated 7-Jan-12 3:40am
v3

 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 7-Jan-12 14:24pm    
Yes, it can, but event the "From: " header can contain anything. (I voted 4.) Please see my answer.
--SA
That's not "mail from", this is the content of the header "From: ". It has nothing to do with the account; so the content of this header can be anything at all.

Why do you think the spammers are very hard to catch? Because e-mail standards were created where most players on Internet were assumed to be honest people, and the absolute majority of people really did not cheat. That's why the standards were created very relaxed and kind of sloppy. Identity of the sender is not passed on or checked up. Nearly everything could be faked in every way.

—SA
 
Share this answer
 

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