Question:

Email Sending in Asp.net 1.1. hi, Tayyab nice to view ur little introduction through peoples. i am

by Guest7308  |  12 years, 10 month(s) ago

0 LIKES UnLike

hi, Tayyab nice to view ur little introduction through peoples. 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: 1.1, asp.net, email, Sending

   Report

1 ANSWERS

  1. Guest8233
    Most probably this error has to do with directory permissions. In essence, the web account that is logged in attempting to send the mail message does not have access to the "pickup" directory where the mail message needs to go to be sent!

    Go to your INETPUB directory on your hard drive. Navigate down to MAILROOT, then PICKUP. Set the PICKUP directory to have full access from IUSR_MACHINENAME where that username matches whatever you use for anonymous web access to your website. Hope this will help you

Sign In or Sign Up now to answser this question!

Question Stats

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

BECOME A GUIDE

Share your knowledge and help people by answering questions.
Unanswered Questions