|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
VB 2003, 0x80040213I'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 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. -- Show quoteHide quote--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 > > > 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 >> >> >>
Strong Name Problems
Me.close vs. End Opinion: VPN or Web Service? Seeking report component.... C# to VB Conversion - 800 lines got - 2 lines beyond me Show dynamically selected row in datagridview custom panel control Spiritual programming? Assembly - Where did I come from? Determine caller class name |
|||||||||||||||||||||||