Rehan meo

Rehan meo

  • NA
  • 8
  • 3.4k

smtp.send(mailMsg)(Define this erroe how can i sove)

Apr 14 2014 6:58 AM
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net.Mail;
using System.Net.Security;
namespace SendEmail
{
public partial class SendEmail : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnSentFeedBack_Click(object sender, EventArgs e)
{
MailMessage mailMsg =new MailMessage();
mailMsg.From = new MailAddress(txtEmail.Text);
mailMsg.IsBodyHtml = true;
mailMsg.Subject = "Contect Details";
mailMsg.Body = "Contact Detail" + "<b>Name<b>" + txtName.Text + "<br /><b>Email-Email :</b>" +
txtEmail.Text + "<br /><b>Comments :<b/>" + txtComment.Text;
SmtpClient smtp = new SmtpClient("[email protected]", 587);
mailMsg.Priority = MailPriority.Normal;
smtp.Credentials = new System.Net.NetworkCredential("[email protected]","abcd");
smtp.Timeout = 25000;
smtp.EnableSsl = true;
smtp.Send(mailMsg);
Label4.Text = "Thanks you.Your contect details and feed Back has been submited.";
}
}
}

Answers (2)