Hi,
I have a code here (taken from http://www.dotnetwatch.com/page294.aspx).
Now i didn't think there was anything wrong with this code(no
compilation errors..nothing)..and infact when i ran this code in
visual web developer in the debug mode, the code DID mail to the
recipient email id. However, after uploading the codes to my hosting
account, upon submiting the form(which sends contents of 'TextBox1'
and 'TextBox3' to rc*@domain.com), a browser message popped up reading
this : 'sys.webform.pagerequestmanagerservererrorExceptio n : an
unknow.error occurred while processing the request on the server the
status code teturned from sever is 500
'
CODE:
_____________
protected void ImageButton1_Click(object sender, ImageClickEventArgs
e)
{
if (Process(TextBox1.Text) == true)
{
Label1.Text = null;
//Create Mail Message Object with content that you want to
send with mail.
System.Net.Mail.MailMessage MyMailMessage = new
System.Net.Mail.MailMessage("se**@gmail.com", "rc*@domain.com",
"WebVisitor:" + DateTime.Now.ToString("MMMM dd yyyy"),
"email: " + TextBox1.Text + "\nquery: " + TextBox3.Text);
MyMailMessage.IsBodyHtml = false;
//Proper Authentication Details need to be passed when
sending email from gmail
System.Net.NetworkCredential mailAuthentication = new
System.Net.NetworkCredential("se**@gmail.com", "password");
//Smtp Mail server of Gmail is "smpt.gmail.com" and it
uses port no. 587
System.Net.Mail.SmtpClient mailClient = new
System.Net.Mail.SmtpClient("smtp.gmail.com", 587);
//Enable SSL
mailClient.EnableSsl = true;
mailClient.UseDefaultCredentials = false;
mailClient.Credentials = mailAuthentication;
mailClient.Send(MyMailMessage);
TextBox1.Text = null;
TextBox3.Text = null;
}
else
{
Label1.Text = "is INVALID";
TextBox1.Text = null;
}
}
_____________