Click here to Skip to main content
15,893,663 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have doubt with feedback form in my project. When I click on send button it sends mails also I am receiving mail but in the field of FROM in my page whichever id I type it is not showing the in my mail box but shows which I have entered in my code.
If I want ID which I type in FROM field then what code should I enter.
Please Help.
Thanks in advance.
Posted
Updated 26-Apr-11 0:59am
v2
Comments
m@dhu 26-Apr-11 6:53am    
You should be doing something wrong in code. Can you show us the code.
chetanp322 26-Apr-11 7:03am    
protected void Button1_Click(object sender, EventArgs e)
{

MailMessage mm = new MailMessage();
MailAddress ma = new MailAddress("abcd@gmail.com");
mm.From = new MailAddress("xyz@gmail.com);
mm.From = ma;
mm.To.Add(new MailAddress("acbd@gmail.com",T1.Text));
mm.Subject = T3.Text;
mm.Body = T4.Text;
mm.IsBodyHtml = false;
SmtpClient sc = new SmtpClient();
sc.Host = "smtp.gmail.com";
sc.Port = 587;
sc.EnableSsl = true;
sc.Credentials = new NetworkCredential("xyz@gmail.com", "password");
sc.EnableSsl = true;
sc.DeliveryMethod = SmtpDeliveryMethod.Network;
sc.Send(mm);
Label6.Visible = true;
Label6.Text = "Mail Sent Successfully";

}
Abhinav S 26-Apr-11 7:04am    
Debug your code to check why this could be happening.

Could this have anything to do with it?
MailAddress ma = new MailAddress("abcd@gmail.com");
mm.From = new MailAddress("xyz@gmail.com");
mm.From = ma;
 
Share this answer
 
Comments
chetanp322 26-Apr-11 7:12am    
Yes Exactly Whichever id i type in here it shows in my mail id.
OriginalGriff 26-Apr-11 7:16am    
Which one? You load the From property with two addresses, one after the other....
Try
mm.To.Add(mm.From);<br />
 
Share this answer
 
Comments
chetanp322 26-Apr-11 7:21am    
I have tried it but not work. It send mail but now i am not receiving only

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