Home All Groups Group Topic Archive Search About
Author
31 May 2006 5:29 PM
Tull Clancey
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.ToString)

            While Not (ex.InnerException Is Nothing)
                ex = ex.InnerException
                MsgBox(ex.ToString)
            End While

        End Try

Author
1 Jun 2006 2:16 AM
ewok66
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


Show quoteHide quote
"Tull Clancey" wrote:

> 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.ToString)
>
>             While Not (ex.InnerException Is Nothing)
>                 ex = ex.InnerException
>                 MsgBox(ex.ToString)
>             End While
>
>         End Try
>
>
>
Author
1 Jun 2006 8:45 AM
Tull Clancey
Ah, this is all starting to ring bells!

Thanks,
Tull.

Show quoteHide quote
"ewok66" <ewo***@discussions.microsoft.com> wrote in message
news:E7CB70AD-BCA1-420C-991C-6BC4E7D4170A@microsoft.com...
> 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:
>
>> 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.ToString)
>>
>>             While Not (ex.InnerException Is Nothing)
>>                 ex = ex.InnerException
>>                 MsgBox(ex.ToString)
>>             End While
>>
>>         End Try
>>
>>
>>