none
The transport failed to connect to the server

    Question

  • Hi again All,

     

    I want to ask you that: i have got an error when i want to send this mail from my home. 

    This is my mail and it is annoying me like that::

    "The transport failed to connect to the server." how can i configurate this settings. i am always giving it to the SmtpServer and other settings they are oke that you can see.

     

    What is wrong?

     

     

    try

                            {

                                CDO.Message oMsg = new CDO.Message();

                                CDO.IConfiguration iConfg;

     

                                iConfg = oMsg.Configuration;

     

                                ADODB.Fields oFields;

                                oFields = iConfg.Fields;

     

                                // Set configuration.

                                ADODB.Field oField = oFields["http://schemas.microsoft.com/cdo/configuration/sendusing"];

     

                                //TODO: To send by using the smart host, uncomment the following lines:

                                oField.Value = CDO.CdoSendUsing.cdoSendUsingPort;

                                oField = oFields["http://schemas.microsoft.com/cdo/configuration/smtpserver"];

                                oField.Value = "secureserver.net";

     

                                // TODO: To send by using local SMTP service. 

                                //oField = oFields["http://schemas.microsoft.com/cdo/configuration/sendusing"];

                                //oField.Value = 1;  

     

                                oFields.Update();

     

                                // Set common properties from message.

     

                                //TODO: To send text body, uncomment the following line: 

                                //oMsg.TextBody = "Hello, how are you doing?";

     

     

                                //TODO: To send HTML body, uncomment the following lines:

                                String sHtml;

                                sHtml = "<HTML>\n" +

                                    "<HEAD>\n" +

                                    "<TITLE>Sample GIF</TITLE>\n" +

                                    "</HEAD>\n" +

                                    "<BODY><P>\n" +

                                    "<h1><Font Color=Green>Inline graphics</Font></h1>\n" +

                                    "</BODY>\n" +

                                    "</HTML>";

                                oMsg.HTMLBody = sHtml;

     

                                //TOTO: To send WEb page in an e-mail, uncomment the following lines and make changes in TODO section.

                                //TODO: Replace with your preferred Web page

                                //oMsg.CreateMHTMLBody("http://www.microsoft.com",

                                // CDO.CdoMHTMLFlags.cdoSuppressNone, 

                                // "", ""); 

                                oMsg.Subject = "Test SMTP"; 

     

                                //TODO: Change the To and From address to reflect your information.                       

                                oMsg.From = "someone@example.com";

                                oMsg.To = "someone@example.com";

                                //ADD attachment.

                                //TODO: Change the path to the file that you want to attach.

                                //oMsg.AddAttachment("C:\\Hello.txt", "", "");

                                //oMsg.AddAttachment("C:\\Test.doc", "", "");

                                oMsg.Send();

                            }

                            catch (System.Exception e)

                            {

                                Console.WriteLine("{0} Exception caught.", e);

                            }

     Thanks All regards...


    Hamit YILDIRIM

    Hamit YILDIRIM
    Monday, August 30, 2010 12:52 PM

Answers

  • Hi,

    This is a network related error. Your application cannot connect to the mail server specified
    SmtpMail.SmtpServer
    Is a valid SMTP Server
    Check to be sure the server System.Web.Mail is executing on can connect to the mail server. Some times firewalls or proxy servers can get in the way.
    Try specifying the value by IP address. Poor DNS resolution can sometimes hinder name lookups.
    Make sure the that the mail server is running at port 25.
    If you did not specify a SmtpMail.SmtpServer property, or if SmtpMail.SmtpServer points to "localhost" (or the equivalent), be sure the SMTP Service is running on port 25.
    For testing purposes change the MailMessage.From and MailMessage.To properties to an address that exists on SmtpMail.SmtpServer. Some times this exception is thrown, when it really is a relay issue.

    Thanks

    Binze


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by Bin-ze Zhao Monday, September 06, 2010 3:01 AM
    Thursday, September 02, 2010 5:31 AM

All replies

  • Hi,

    This is a network related error. Your application cannot connect to the mail server specified
    SmtpMail.SmtpServer
    Is a valid SMTP Server
    Check to be sure the server System.Web.Mail is executing on can connect to the mail server. Some times firewalls or proxy servers can get in the way.
    Try specifying the value by IP address. Poor DNS resolution can sometimes hinder name lookups.
    Make sure the that the mail server is running at port 25.
    If you did not specify a SmtpMail.SmtpServer property, or if SmtpMail.SmtpServer points to "localhost" (or the equivalent), be sure the SMTP Service is running on port 25.
    For testing purposes change the MailMessage.From and MailMessage.To properties to an address that exists on SmtpMail.SmtpServer. Some times this exception is thrown, when it really is a relay issue.

    Thanks

    Binze


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by Bin-ze Zhao Monday, September 06, 2010 3:01 AM
    Thursday, September 02, 2010 5:31 AM
  • I all , I have faced the same problem. I had used System.Wem.mail utility. After spending lots of hours and losing my hairline, One of my friend advised me to apply a trick and It worked. The trick is

    SmtpMail.SmtpServer =String.Empty ;I.E making the server name empty.

    Friday, February 24, 2012 5:41 AM