Quantcast
Channel: CodeProject Latest postings for ASP.NET
Viewing all articles
Browse latest Browse all 3938

Feedback form on my website to email feedback

$
0
0
I need help please programmers, i need help i don't understand smtp.

____________________________________________
protectedvoid Unnamed6_Click(object sender, EventArgs e)
          {
 
              MailMessage mailMsg = new MailMessage();
              SmtpClient smtp = new SmtpClient();
            try
            {
                mailMsg.From = new MailAddress(Email.Text);
 
                mailMsg.To.Add("admin@mydomain.co.za");
 
                mailMsg.IsBodyHtml = false;
 
                mailMsg.Subject = "Contact Details";
 
                mailMsg.Body = "Contact Details" + "<b>Name:</b>" + names.Text + "<br/> <b>Email - address :</b>" + Email.Text + "<br/> <b>Comments :</b>" + mgs.Text;
 

 
                mailMsg.Priority = MailPriority.High;
                smtp.Host = "localhost";
                smtp.Port = 25;
 
                smtp.Credentials = new System.Net.NetworkCredential();
 
                smtp.Timeout = 25000;
 
                smtp.EnableSsl = true;
 
                smtp.Send(mailMsg);
 
                lblStatus.Text = "Thank you. Your contact details and feed back has been submitted.";
 

            }
            catch (Exception ex)
            {
                lblStatus.Text = "Send Email Failed." + ex.Message;
            }
}

---------------------------------------------------------------
Here is an output==

Send Email Failed.Failure sending mail.

Viewing all articles
Browse latest Browse all 3938

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>