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