.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Imran Ghani

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum


Posted By: Shweta     Posted Date: January 27, 2011    Points:2   Category :ASP.Net
i m having enquiry form in my website.
after clicking the submit button the mail goes to the correct mail address but the in 'from' tag its showing the same email address as that of the destination mail address
thus 'to' and 'from' has the same email address inspite of the different address filled in the form.

the code of the button_click() is as below:
protected void btnSend_Click(object sender, EventArgs e)
MailMessage msg = new MailMessage();

msg.To.Add(new MailAddress("abc@xyz.com"));

msg.From = new MailAddress(txtEmail.Text);

msg.Subject = txtSubject.Text;

msg.Body = txtName.Text + Environment.NewLine + txtMessage.Value;

SmtpClient client = new SmtpClient();

client.Host = "smtp.xyz.com";//Place your smtp server in quotation marks (i.e. "smtp.live.com")

client.Port = 587;// Place your smtp port here, i.e. hotmail's smtp port is 587

client.Credentials = new NetworkCredential("username","password");

client.EnableSsl = true;



plz help to resolve.

Author: Amit Mehra             
Posted Date: January 30, 2011     Points: 5   


Thats strange..Check the from email address properly..It can not be the same.

Please "Mark As Answer " if this post help you.
Author: Blessy Baby             
Posted Date: February 01, 2011     Points: 5   


Please check are you entering the same address in the textbox.

Blessy Baby
Project Lead
Digitalmesh Softech India (p) Limited

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend