System.Web.Mail "The transport failed to connect to the server"

I have been trying to get this email form working all night.  I just moved my site to a new server and now my forms do not work. 

<% @Import Namespace="System.Web.Mail" %>
<script language="vb" runat="server">

Sub btnSendFeedback_Click(sender as Object, e as EventArgs)

  'Create an instance of the MailMessage class
  Dim mail as New MailMessage()

  'Set the properties - send the email to the person who filled out the
  'feedback form.
  mail.To = "info@mydomain.com"
  mail.From = txtEmail.Text

  'If you want to CC this email to someone else, uncomment the line below
  'objMM.Cc = "someone@someaddress.com"

  'If you want to BCC this email to someone else, uncomment the line below
  'objMM.Bcc = "someone@someaddress.com"

  'Send the email in text format
  mail.BodyFormat = MailFormat.Text
  '(to send HTML format, change MailFormat.Text to MailFormat.Html)

  'Set the priority - options are High, Low, and Normal
  mail.Priority = MailPriority.High

  'Set the subject
  mail.Subject = "Property Information Form"

  'Set the body
  mail.Body = "At " + DateTime.Now + " feedback was sent from an ASP.NET " & _
               "Web page.  Below you will find the feedback message " & _
               "send by " & txtName.Text & "." & vbCrLf & vbCrLf & _
               "______________________________________" & vbCrLf & vbCrLf & _
               "MLS: " & txtMLS.Text & vbCrLf & _
      "Name: " & txtName.Text & vbCrLf & _
      "Email: " & txtEmail.Text & vbCrLf & vbCrLf & _
      "______________________________________" & vbCrLf & _
      "Would you like us to email you listings that are simular to this listing? " & txtListSim.SelectedItem.Text & vbCrLf & _
      "How many days to recieve simular listings? " & txtListDays.Text & vbCrLf & _
      "______________________________________" & vbCrLf & _
      "Message " & txtMessage.Text  & vbCrLf & _     
      "______________________________________"

 
  'Specify to use the default Smtp Server
  SmtpMail.SmtpServer = "mail.mydomain.com"
 
  'Now, to send the message, use the Send method of the SmtpMail class
  SmtpMail.Send(mail)

 'Redirect the user to a page that tells them the message has been sent.
 Response.redirect ("thanks.htm")

End Sub
</script>
___________________________

I have checked and re-checked it and everything looks to be in place.  I have search the error I am getting

"The transport failed to connect to the server."

I called my hosting company and made sure my mail.mydomain.com (mail server) was on the local machine but then he told me to send emails through a form on a site I had to be put on a list that will allow me to do it from all isp. 


Any help would be great

0
abyss42
7/9/2005 3:36:40 AM
asp.net.web-forms 93655 articles. 6 followers. Follow

4 Replies
1023 Views

Similar Articles

[PageSpeed] 4
Get it on Google Play
Get it on Apple App Store

Try changing your SmtpServer to "127.0.0.1" or "localhost" as follows.  This should fix your problem.


   SmtpMail.SmtpServer = "127.0.0.1"




Hope this helps,
Matt

ADV Enterprises
www.adventerprises.net
0
aspnet_novice
7/9/2005 6:30:46 AM
Hi Friend,
I tried to send an email from local machine "anaam" to my local default  smtp server "anaam.com" and i found that when i change the smtpserver as
system.web.mail.smtpserver="any thing else than anaam.com"
I am getting the error message that you got.So I think your problem is from the line where u set smtpserver i.e.

'Specify to use the default Smtp Server
  SmtpMail.SmtpServer = "mail.mydomain.com"

try to change this line and let me what you get

waiting for replay I remain....
    Yousef Bahwal
          MCP
0
netsoft
7/9/2005 8:21:31 AM
if you change to different server that means you need to check authentication and access rights .......confirm again before anything 

Fadil Alnassar
www.fadilalnassar.com | FREE Nodil Tab Control
http://www.mefranchising.com
0
fadil1977
7/9/2005 11:14:31 AM
I called my hosting company "ait" and they said it is because I am not on the "whitelist" yet and so I went to aol and filled out the form for the whitelist.  I do not understand how the whitelist can stop my site from working.  Is this true about it?  Has anyone else run into this problem?
0
abyss42
7/9/2005 6:56:14 PM
Reply:

Similar Artilces:

System.Exception: System.Web.HttpException: The transport failed to connect to the server. System.Runtime.InteropServices.COMException (0x80040213): The transport failed to connect to the server.
I have an application which creates about 50 XML packages and sends a notification about the success/failure of every package. I am running this code in threads and I have restricted maximum no. of threads that can be active at any time to 2.So the package generation and the notification would be performed for 2 packages in parallal. But while sending notifications to users, I am getting the below error only for very few packages[ 1 or 2 out of 50] . The same base code is used by all the packages but i am getting this error intermittently. System.Exception: Error sending mail to [So...

System.web.mail gmail error: System.Web.HttpException: The transport failed to connect to the server
Hello there, Im using VWD2008 and sql server express for the development of my school project..I have an application which could send newsletter to subscribed user, but i get this error upon sending the mail: A general exception occurred! System.Web.HttpException: The transport failed to connect to the server. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x80040213): The transport failed to connect to the server. --- End of inner exception stack trace --- at System.Runtim...

Programmatically Populating the "mail.settings" section of "system.net" in web.config
I am fully aware that the system.net section of web.config typically looks something like this:  <system.net>    <mailSettings>      <smtp from="noreply@sample.com">        <network host="smtp_server_address" userName="myUsername" password="myPassword" />      </smtp>    </mailSettings>  </system.net>If web.config is so populated then this info is used for sending e-mails generally and al...

difference between "using System.Web.UI.WebControls" or "System.Web.UI.WebControls.ServerValidateEventArgs"
Hi all, quick question. I'm writing a custom validation method. In the declaration it has: protected void CustomValidator1_ServerValidate(object source, System.Web.UI.WebControls.ServerValidateEventArgs args) Is there any difference between doing that, vs doing: using System.Web.UI.WebControls; protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args) Do they do the same thing? Is it any more efficient when processing the request to do it one way or another? Is there a technical term for what i am talking about? Thanks in advance for any explanation ...

How to change "File System" web site to "HTTP" Web site
I created a new web site as file based "File System". How can I change this same site to "HTTP" based web site. When createing a new website notice the Location pulldown box contains 3 options (File System, HTTP, FTP) But I do not see how to change my "File System" web site to "HTTP" when the project is alredy created and open. Please advise!! Well, you can open IIS, create a new website. Set its home directory to the Web folder of your site. Then go and create a new project using http. I don't really think you can convert between File Syst...

Encrypting "connection strings" and "mail settings" in web.config
I'm trying to encrypt two sections of my web.config.  Encryption works fine when I try encrypting either <connectionStrings> or <system.net/mailSettings/smtp> alone.  But when I try and do both together, I get an error and only the <connectionStrings> section encrypts properly.  Here's the error:Parser Error Message: The configuration file has been changed by another program.Source Error: [No relevant source lines] Here's the code I'm using . . .protected void EncryptConfig(bool bEncrypt) {obje...

"Visual Web Developer Web Server" and Web Services
I like the new "Visual Web Developer Web Server" (Do you want suggestions for a longer name!) but I have an issue with using it to host a Web Service. Whenever the Web Service is recompiled and run it ends up with a different port number. Therefore, it seems that any references to that WS in other applications are invalidated and need to be re-established when it's run again. Is there a way of pinning the port number, or am I missing something? CheersNick Grattan, MSDN Regional Director, Ireland. Software Paths Limited. Hi Nick, the internal server is used for local...

Is that need to upload "global.asax", "web.config" file to web server?
hi all...here is my problem......... Is that need to upload "global.asax", "web.config" file to web server? let say my asp.net main form is "WebForm1.aspx, after i upload WebForm1.aspx to webserver, Is that need to upload "global.asax", "web.config" or other file to the website? Hi, You need to upload your web.config file. If you are making use of your global.asax, then you need to upload the same. Making use, per say, you are storing some application variables etc., in the global.asax.vb or .cs files. Note that you don't nee...

Load Balaned Web Servers (or Web Farm) with "Fail-Over" versus Session Variables??
Hi, I like using Session variables to hold on to the current users ID (and prove they are logged in & valid etc).  However Im working on a project which will be deployed using multiple web servers.  All should be fine if load balancing is configured so that each new user is linked to the initial web server they get on their first request.  Right?  .. So that will be the load balancing taken care of.  BUT.. users will be kicked off if that one web server goes down...  not really the point of all those web servers... so, the tech...

"System.Web.Mail.SmtpMail.Send" fails with large attachments
The mail was sent with the attachments of 10286 KB (10.04 MB) But, The mail was not sent with the attachments of 15356 KB (14.99 MB) but the attachments were attached to the application successfully and I did not receive any error.I have done the following in my ASP.Net application            Web.Mail.SmtpMail.SmtpServer = "10.2.3.6"            mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", 1)      ...

2 script tags, Script Language="javascript" and Script runat="server" in a web form.
Where should i place the javascript portion in the webform if i already had my <script runat="server"> (VB) place afterthat? Mark up: i understand that it should have 2 script tags used in the web form.  <SCRIPT LANGUAGE="JavaScript"> var isNN = (navigator.appName.indexOf("Netscape")!=-1); ...etc</script> <script runat="server">     Dim x, iRow, iCol, noRec As Integer   Dim i As Integer ... etc. <script> <asp:Content ID="First" ContentPlaceHolderID="aad"...

"visual web developer does not support creating web sites on a Sharepoint Web Server"
I get this message when I try to create a web site using VS2005 using HTTP, not the file system. "visual web developer does not support creating web sites on a Sharepoint Web Server". Anyone know how to fix this?  Thanks Added info for the above post:I am running Windows XP locally and simply am trying to create a web site in VS2005 using HTTP.  I am not using Visual Web Developer, nor do I have it installed on my machine.The error message mentions Visual Web Developer, so I wanted to clarify that I'm running VS2005 and not VWD.Thanks This is the third report I've s...

Error: "Unable to connect to Visual Studio's Localhost Web Server" when running a local web project
I get the above error when I try to run my project.  Any ideas what the configuration of the computer needs to be in order to run VS2005's local web server? Ok, the problem is that I apparently don't have the executable on my machine.  Does anyone know how I can reinstall this executable?  I've tried to repair my .NET studio installation, but no luck. I got same proplem , did you solve it ? if you .. please help me Thanks Top Systems Inc.Coding ServicesBooks Download I accidentally hit my firewall program to block the web server application.  When I fig...

Adding reference to "system.web.dll and system.web.extensions.dll"
Every time I drop a control on a Ajax page I have to wait about a min for it to add these extensions. When I view my code-behind page I have no intellisense for my "using System.web" - name space. I'm running Vista - VS2005. any suggestions? Fixed this problem with a repair to my Visual Studio 2005 installation ;-)...