Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Failure sending mail

Author  Topic 

vbuser26
Starting Member

21 Posts

Posted - 2007-05-21 : 23:47:45
Why am i having error failure sending mail in this code.


protected void btnSubmit_Click(object sender, EventArgs e)
{
try
{
MailMessage message = new MailMessage("txtFrom.Text", txtTo.Text, txtSubject.Text, txtMsg.Text);
SmtpClient emailClient = new SmtpClient(txtSMTPServer.Text);
System.Net.NetworkCredential SMTPUserInfo = new System.Net.NetworkCredential(txtSMTPUser.Text, txtSMTPPass.Text);
emailClient.UseDefaultCredentials = false;
emailClient.Credentials = SMTPUserInfo;
emailClient.Send(message);
LitStatus.Text = "Message Sent";

}
catch (Exception ex)
{
LitStatus.Text = ex.ToString();
}
}

vbuser26
Starting Member

21 Posts

Posted - 2007-05-23 : 01:15:28
I already done it thanks anyway
Go to Top of Page
   

- Advertisement -