Question:

Email Sending in .net 1.1 using asp.net

by Guest6108  |  12 years, 9 month(s) ago

0 LIKES UnLike

i am a beginner programmer of same technology. I have a problem . I want to send email through C# code but i am getting error. On send button click I have simply writtten the code:

private void btnSend_Click(object sender, System.EventArgs e)
{
MailMessage mail = new MailMessage();
mail.To = txtTo.Text;
mail.From = txtFrom.Text;
mail.Subject = txtSubject.Text;
mail.Body = txtBody.Text;
SmtpMail.SmtpServer = "localhost";
SmtpMail.Send(mail);
}
but I am getting following Error:

System.Runtime.InteropServices.COMException: The transport failed to connect to the server.

How to fix this error? Waiting for your reply

 Tags: .net, 1.1, asp.net, email, Sending, Using

   Report

2 ANSWERS

  1. Jessica_Nancy
    have you setup smtp on server.

  2. Guest5983
    no i dnt know how to set SMTP on server
Sign In or Sign Up now to answser this question!

Question Stats

Latest activity: 14 years, 11 month(s) ago.
This question has 2 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.