Click here to Skip to main content
15,922,407 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I am trying to send mail from my application.
when I am using it in my machine it sending mail sucessfully. but when i am using it on clients machine it gives me error


Failure sending mail.- at System.Net.Mail.SmtpClient.Send(MailMessage message), internal exception: could not connect to remote server

The server is situated at clients place.
should I make any IIS setting?
I am not getting where the problem is.
Posted
Updated 20-May-11 0:16am
v2

is it possible to try a telnet to the email server port 25 at the client machine?
 
Share this answer
 
open a command prompt (I know, very old-fashioned, but it does the trick :-) and type:
telnet mailsvr 25

mailsvr is ofcourse the name of your mailserver. Telnet needs to be enabled in programs and features if you use Windows 7 (it is turned off by default). The cmd window should refresh and show a message stating you are connected to the mail server. If it does not, there is some network issue with the SMTP protocol (which is port 25). If you get a connection you can even try to send email using the SMTP commands in the window. How the SMTP commands work depends on the email server you are using.
 
Share this answer
 
v2
Comments
Sweetu deshpande 20-May-11 6:29am    
Its not working.. error:
telnet is not not recognised as internal or external command ????
Mart Rijkers 20-May-11 6:43am    
Using Windows 7? Go to control panel --> programs and select "Turn Windows features on or off". Select Telnet to be on.
Sweetu deshpande 23-May-11 6:35am    
client is using windows server 2008 R2
still having problem in sending mails :(
Sweetu deshpande 31-May-11 5:07am    
thanks for your help...
client was using Quickheal antivirus ....
this antivirus was blocking my mails.
I have disabled antivirus mail blocking functionality and now its working properly :)
System.Net.Mail reads SMTP configuration data out of the standard .NET configuration system (so for ASP.NET applications you’d configure this in your application’s web.config file). Here is an example of how to configure it:

<pre lang="xml"><system.net>
    <mailSettings>
      <smtp from="test@foo.com">
        <network host="smtpserver1" port="25" userName="username" password="secret" defaultCredentials="true" />
      </smtp>
    </mailSettings>
  </system.net>


Hope this Helps out.
 
Share this answer
 
Comments
Sweetu deshpande 20-May-11 6:46am    
Still having same error.
my code was working up to yesterday morning. but from yesterday afternoon its showing this error.
Sweetu deshpande 31-May-11 5:07am    
thanks for your help...
client was using Quickheal antivirus ....
this antivirus was blocking my mails.
I have disabled antivirus mail blocking functionality and now its working properly :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900