VB 2003, 0x80040213

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tull Clancey

    #1

    VB 2003, 0x80040213

    Hi all.

    I'm using the following code to attempt to send Email, it's part of an
    application I'm writing. I don't need any fancy stuff, just a simple text
    message. This code is just for testing but the final thing wont be any
    different apart from dragging info from a database.

    I can't get around the dreaded 0x80040213 error, The transport failed to
    connect to the server.

    From and To are definately correct, I've tried my ISP hostname, IP and
    localhost and nothing changes, same error.

    What pre-requisites do I need before I can send mail? Exchange? a local
    SMTP server?

    I've always understood as long as I have a Gateway connection to a router,
    'localhost' should find my ISP and forward mail, as long as they receive on
    port 25. I've checked all virus protection, port 25 is open, can't see
    anything in the firewall that should cause a problem.

    I've searched every group I can think of, most point to Exchange errors.
    The annoying think is, I'm sure this worked 6 months ago!

    Any help would be very much appreciated!


    Dim mail As System.Web.Mail .SmtpMail
    Dim msg As New System.Web.Mail .MailMessage

    msg.From = txtFrom.Text
    msg.To = txtRecip.Text
    msg.Subject = txtSubject.Text
    msg.Body = txtMessage.Text
    msg.BodyFormat = MailFormat.Text

    mail.SmtpServer = "localhost"

    Try
    mail.Send(msg)
    Catch ex As Exception
    MsgBox(ex.ToStr ing)

    While Not (ex.InnerExcept ion Is Nothing)
    ex = ex.InnerExcepti on
    MsgBox(ex.ToStr ing)
    End While

    End Try


  • ewok66

    #2
    RE: VB 2003, 0x80040213

    You will need an SMTP server you can relay through. <localhost> refers to
    the machine you are running the application from; most PCs don't have an SMTP
    server or smartrelay on them, and <localhost> will not find your ISP, since
    by definition <localhost> is the PC the application is running on.

    You will need to know the Fully Qualified Domain Name (i.e.
    servername.isp. com) of the SMTP server, and be allowed to relay through it.

    --
    --ewok
    MCSA+M,MCSE, MCSD, MCDBA,MCITP


    "Tull Clancey" wrote:
    [color=blue]
    > Hi all.
    >
    > I'm using the following code to attempt to send Email, it's part of an
    > application I'm writing. I don't need any fancy stuff, just a simple text
    > message. This code is just for testing but the final thing wont be any
    > different apart from dragging info from a database.
    >
    > I can't get around the dreaded 0x80040213 error, The transport failed to
    > connect to the server.
    >
    > From and To are definately correct, I've tried my ISP hostname, IP and
    > localhost and nothing changes, same error.
    >
    > What pre-requisites do I need before I can send mail? Exchange? a local
    > SMTP server?
    >
    > I've always understood as long as I have a Gateway connection to a router,
    > 'localhost' should find my ISP and forward mail, as long as they receive on
    > port 25. I've checked all virus protection, port 25 is open, can't see
    > anything in the firewall that should cause a problem.
    >
    > I've searched every group I can think of, most point to Exchange errors.
    > The annoying think is, I'm sure this worked 6 months ago!
    >
    > Any help would be very much appreciated!
    >
    >
    > Dim mail As System.Web.Mail .SmtpMail
    > Dim msg As New System.Web.Mail .MailMessage
    >
    > msg.From = txtFrom.Text
    > msg.To = txtRecip.Text
    > msg.Subject = txtSubject.Text
    > msg.Body = txtMessage.Text
    > msg.BodyFormat = MailFormat.Text
    >
    > mail.SmtpServer = "localhost"
    >
    > Try
    > mail.Send(msg)
    > Catch ex As Exception
    > MsgBox(ex.ToStr ing)
    >
    > While Not (ex.InnerExcept ion Is Nothing)
    > ex = ex.InnerExcepti on
    > MsgBox(ex.ToStr ing)
    > End While
    >
    > End Try
    >
    >
    >[/color]

    Comment

    • Tull Clancey

      #3
      Re: VB 2003, 0x80040213

      Ah, this is all starting to ring bells!

      Thanks,
      Tull.

      "ewok66" <ewok66@discuss ions.microsoft. com> wrote in message
      news:E7CB70AD-BCA1-420C-991C-6BC4E7D4170A@mi crosoft.com...[color=blue]
      > You will need an SMTP server you can relay through. <localhost> refers to
      > the machine you are running the application from; most PCs don't have an
      > SMTP
      > server or smartrelay on them, and <localhost> will not find your ISP,
      > since
      > by definition <localhost> is the PC the application is running on.
      >
      > You will need to know the Fully Qualified Domain Name (i.e.
      > servername.isp. com) of the SMTP server, and be allowed to relay through
      > it.
      >
      > --
      > --ewok
      > MCSA+M,MCSE, MCSD, MCDBA,MCITP
      >
      >
      > "Tull Clancey" wrote:
      >[color=green]
      >> Hi all.
      >>
      >> I'm using the following code to attempt to send Email, it's part of an
      >> application I'm writing. I don't need any fancy stuff, just a simple
      >> text
      >> message. This code is just for testing but the final thing wont be any
      >> different apart from dragging info from a database.
      >>
      >> I can't get around the dreaded 0x80040213 error, The transport failed to
      >> connect to the server.
      >>
      >> From and To are definately correct, I've tried my ISP hostname, IP and
      >> localhost and nothing changes, same error.
      >>
      >> What pre-requisites do I need before I can send mail? Exchange? a local
      >> SMTP server?
      >>
      >> I've always understood as long as I have a Gateway connection to a
      >> router,
      >> 'localhost' should find my ISP and forward mail, as long as they receive
      >> on
      >> port 25. I've checked all virus protection, port 25 is open, can't see
      >> anything in the firewall that should cause a problem.
      >>
      >> I've searched every group I can think of, most point to Exchange errors.
      >> The annoying think is, I'm sure this worked 6 months ago!
      >>
      >> Any help would be very much appreciated!
      >>
      >>
      >> Dim mail As System.Web.Mail .SmtpMail
      >> Dim msg As New System.Web.Mail .MailMessage
      >>
      >> msg.From = txtFrom.Text
      >> msg.To = txtRecip.Text
      >> msg.Subject = txtSubject.Text
      >> msg.Body = txtMessage.Text
      >> msg.BodyFormat = MailFormat.Text
      >>
      >> mail.SmtpServer = "localhost"
      >>
      >> Try
      >> mail.Send(msg)
      >> Catch ex As Exception
      >> MsgBox(ex.ToStr ing)
      >>
      >> While Not (ex.InnerExcept ion Is Nothing)
      >> ex = ex.InnerExcepti on
      >> MsgBox(ex.ToStr ing)
      >> End While
      >>
      >> End Try
      >>
      >>
      >>[/color][/color]


      Comment

      Working...