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


Top 5 Contributors of the Month
david stephan

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

Mail

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;

client.Send(msg);


}


plz help to resolve.

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

Hi,

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

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

hi,

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

Blessy Baby
Project Lead
Digitalmesh Softech India (p) Limited
Cochin,Kerala


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
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

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