asif basha

asif basha

  • NA
  • 41
  • 0

How can i eliminate this error??

Aug 20 2009 5:25 AM
 MailMessage mail = new MailMessage();
        mail.To = "[email protected]";
        mail.From = "[email protected]";
        mail.Subject = "this is a test email.";
        mail.Body = "this is my test email body.";
        MailAttachment attachment = new MailAttachment(Server.MapPath("somemail1.txt")); //create the attachment
        mail.Attachments.Add(attachment);    //add the attachment
        SmtpMail.SmtpServer = "localhost";  //your real server goes here
        SmtpMail.Send(mail);


While running this code Im gettin error saying:transport failed to connect to the server

Answers (2)