Please help... "Transport failed" error.. sending email using ASP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kpdeepu
    New Member
    • Dec 2007
    • 8

    Please help... "Transport failed" error.. sending email using ASP

    Hi all,

    I am a complete newbie to ASP and am trying to send email from my gmail account to another gmail ID. Is it possible? I have my computer with no mail server installed. i have IIS installed and working. i have used the following code. I am getting the error..

    CDO.Message.1 (0x80040213)
    The transport failed to connect to the server.

    the error is throwing at '.Send' line. the actual mail IDs given in from and to are real and existing ones... Please help me out..

    [code=asp]
    <html>
    <head>
    <title>Mail send</title>

    <%
    sch = "http://schemas.microso ft.com/cdo/configuration/"

    Set cdoConfig = CreateObject("C DO.Configuratio n")

    With cdoConfig.Field s
    .Item(sch & "sendusing" ) = 2
    .Item(sch & "smtpserver ") = "smtp.gmail.com "
    .update
    End With

    Set cdoMessage = CreateObject("C DO.Message")

    With cdoMessage
    Set .Configuration = cdoConfig
    .From = "myemail1@gmail .com"
    .To = "myemail2@gmail .com"
    .Subject = "Sample CDO Message"
    .TextBody = "This is a test for CDO.message"
    .Send
    End With

    Set cdoMessage = Nothing
    Set cdoConfig = Nothing
    %>

    </head>

    <body>

    </body>
    </html>[/code]

    Thank u in advance..
    Last edited by JamieHowarth0; Feb 6 '08, 02:15 AM. Reason: Added [code] tags
  • DrBunchman
    Recognized Expert Contributor
    • Jan 2008
    • 979

    #2
    Hi there,

    You can follow these steps to send mail from your machine.

    First you need to install default smtp server on your IIS. To do this go to Control Panel...Add/Remove Programs...Add/Remove Windows Components, select Internet Information Services and click details. There will be an smtp check box which you need to select then click next.

    Now all you need to do is change one line in your code:

    .Item(sch & "smtpserver ") = "smtp.gmail.com "

    becomes:

    .Item(sch & "smtpserver ") = "127.0.0.1"

    This will send the mail from your smtp but it will appear in the inbox as being from whichever from address you specify. This does mean that any mail you send out will not appear in a 'Sent Items' box.

    I hope this helps but if you have any problems then please let me know.

    Good luck,

    Dr B

    Comment

    • kpdeepu
      New Member
      • Dec 2007
      • 8

      #3
      Originally posted by DrBunchman
      Hi there,

      You can follow these steps to send mail from your machine.

      First you need to install default smtp server on your IIS. To do this go to Control Panel...Add/Remove Programs...Add/Remove Windows Components, select Internet Information Services and click details. There will be an smtp check box which you need to select then click next.

      Now all you need to do is change one line in your code:

      .Item(sch & "smtpserver ") = "smtp.gmail.com "

      becomes:

      .Item(sch & "smtpserver ") = "127.0.0.1"

      This will send the mail from your smtp but it will appear in the inbox as being from whichever from address you specify. This does mean that any mail you send out will not appear in a 'Sent Items' box.

      I hope this helps but if you have any problems then please let me know.

      Good luck,

      Dr B

      Thanks Dr B!
      I checked my IIS details.. the smtp check box is already checked. i changed the smtpserver from smtp.gmail.com to 127.0.0.1. Now, it is throwing the following error at the same line:

      (0x80040211)

      Plzzzz help.. thanks a lot!

      Comment

      • DrBunchman
        Recognized Expert Contributor
        • Jan 2008
        • 979

        #4
        Ah...there are a couple of things which I know of that you can check:
        • Check that your default smtp port is set to 25. If you go to the properties of your smtp in IIS (from running inetmgr) and click on the advanced button of the general tab it will show you which port you are using.
        • Have you got any kind of firewall or anti virus software running? McAfee and things like that can sometimes block smtp on port 25.
        I'm sorry to say that smtp can be a real pain to get configured sometimes but i'm sure we'll get it cracked!

        Dr B

        Comment

        • kpdeepu
          New Member
          • Dec 2007
          • 8

          #5
          Originally posted by DrBunchman
          Ah...there are a couple of things which I know of that you can check:
          • Check that your default smtp port is set to 25. If you go to the properties of your smtp in IIS (from running inetmgr) and click on the advanced button of the general tab it will show you which port you are using.
          • Have you got any kind of firewall or anti virus software running? McAfee and things like that can sometimes block smtp on port 25.
          I'm sorry to say that smtp can be a real pain to get configured sometimes but i'm sure we'll get it cracked!

          Dr B
          Still the same case! :( Checked both the above steps.. but still getting the same error.. i got some link..

          http://www.gulfstreamw ay.com/dss/company/xlinesoft/ticket/ViewKBArticle.a sp?folder=xline soft&aid=74&cat id=27&f=1&vc=1& asktx=

          followed the steps given there too.. but still not working :(
          sorry if i am bugging.. wat can be done now??

          Comment

          • kpdeepu
            New Member
            • Dec 2007
            • 8

            #6
            Another problem now.. :(

            Hey the error is solved somehow.. but the mail is not getting delivered.. it is getting saved in C:\Inetpub\mail root\Queue folder. :(

            Comment

            • JamieHowarth0
              Recognized Expert Contributor
              • May 2007
              • 537

              #7
              Hi kpdeepu,

              Are you running this on your machine at home or on paid-for webspace of some kind, and if the former, what type of Internet connection do you have?

              medicineworker

              Comment

              • kpdeepu
                New Member
                • Dec 2007
                • 8

                #8
                Originally posted by medicineworker
                Hi kpdeepu,

                Are you running this on your machine at home or on paid-for webspace of some kind, and if the former, what type of Internet connection do you have?

                medicineworker

                Hi medicineworker,

                i am running this on my office computer.

                Comment

                • JamieHowarth0
                  Recognized Expert Contributor
                  • May 2007
                  • 537

                  #9
                  OK, chances are your office uses some kind of DSL or cable service - which means you have a dynamic IP.

                  One of the adopted "laws" of the Internet by many ISPs is that of refusing mail from mail servers with dynamic IP addresses (commonly used by domestic ISPs). The reason is that 99% of mail sent by mail servers with a dynamic IP is produced by "botnet" software using your home PC as an email powerhouse to send out trash advertising discount Viagra and 419 fake lottery scams. This can be very frustrating for the small business or the avid tech home-user who wants to run a website and email server from home or on a cheap Internet connection (like me!).

                  My suggestion - either ask your ISP for permission to relay through their server or use a third-party company to relay. I use DNSExit and highly recommend their prices, although have had service issues previously.

                  Once you have found someone who will let you relay mail, the next thing to do is set up the relay so that every time an email is sent from your SMTP server (e.g. using ASP CDO).

                  Open Internet Information Services on your PC and go to "Default SMTP Virtual Server". Right-click on it and select Properties > Delivery. Click on the "Advanced.. ." button, and in the "Smart host" box, enter the address of the server that you will be relaying mail on to.

                  The idea of a relay server is literally to send mail onto a server but not alter any of the "to" or "from" fields - so it retains your email address and not that of your ISP!

                  Also make sure that if you have a firewall on your company network, that port 25 is open.

                  Hope it helps!

                  medicineworker

                  Comment

                  Working...