Hello people,
Please i need your help here. I have been trying to send mail in my asp.net, but no success.Click this link and try sending mail to see the error:"http://www.ckcayangba.com/Contents/Contacus.aspx". Honestly i don't know where i am going wrong. Here is my code behind:
protected void ImageButton_Submit_Click(object sender, ImageClickEventArgs e)
{
try
{
MailMessage mMailMessage = new MailMessage();
mMailMessage.From = new MailAddress(HttpUtility.HtmlEncode(TextBoxEmail.Text));
mMailMessage.To.Add(new MailAddress("denmarkstan@yahoo.com"));
// mMailMessage.Bcc.Add(new MailAddress(bcc));
// mMailMessage.CC.Add(new MailAddress(cc));
mMailMessage.Subject = "From:" + HttpUtility.HtmlEncode(TextBoxYourName.Text) + "-" + HttpUtility.HtmlEncode(TextBoxSubject.Text);
mMailMessage.Body = HttpUtility.HtmlEncode(EditorEmailMessageBody.Content);
mMailMessage.IsBodyHtml = true;
mMailMessage.Priority = MailPriority.Normal;
SmtpClient mSmtpClient = new SmtpClient("mail.ckcayangba.com");
mSmtpClient.Send(mMailMessage);
LabelMessage.Text = "Thank You - Your Message was sent.";
}
catch (Exception exp)
{
throw new Exception("ERROR: Unable to Send Contact - " + exp.Message.ToString(), exp);
}
}