1

I am trying to send mail using smtp server but i am getting following Exception. Please give me some advice..

System.Net.Mail.SmtpException: Failure sending mail.
---> System.Net.WebException: Unable to connect to the remote server
---> System.Net.Sockets.SocketException: A socket operation was attempted to an unreachable network 184.xx.xxx.xx:25
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket 6, Int32 timeout)
at System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback)
at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback)
at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncD elegate asyncCallback, Int32 creationTimeout)
at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port)
at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port)
at System.Net.Mail.SmtpClient.GetConnection()
at System.Net.Mail.SmtpClient.Send(MailMessage message)
--- End of inner exception stack trace ---
at System.Net.Mail.SmtpClient.Send(MailMessage message) at testEmail.Module1.Main() in E:\testEmail\testEmail\Module1.vb:line 17

Owen Blacker
  • 4,117
  • 2
  • 33
  • 70
ujas patel
  • 101
  • 1
  • 3
  • 7

2 Answers2

0

The message tells me that your webserver has problems connectiong to your SMTP server. Are you sure the SMTP address is right?

Remember that some SMTP-servers need logon

Also some SMTP servers will not let you connect if your use a different IPS

I would change the SMTP to the one your ISP has. You can try to connect to the SMTP with Telnet to check your connection

telnet YourSmtpAddress 25
Eystein Bye
  • 5,016
  • 2
  • 20
  • 18
  • Can you ping it, or telnet to it on port 25? – Eystein Bye Nov 15 '11 at 10:15
  • i am not able to connect to my SMTP Server using telnet with port 25.Is ISP block my port 25? – ujas patel Nov 15 '11 at 10:20
  • What is the massage you get: Does it just say Trying... or do you get an error-message? – Eystein Bye Nov 15 '11 at 10:27
  • Remember that the SMTP server you need to use is the one that your client uses. So if the client has a different ISP then you, you need to use a different SMTP server. That is if you do not have your own SMTP server. – Eystein Bye Nov 15 '11 at 10:32
  • It shows following message Microsoft Telnet> open mail.xxxxx.com 25 Connecting To mail.xxxxx.com...Could not open connection to the host, on port 25: Connect failed – ujas patel Nov 15 '11 at 11:12
  • Problem resolved. I used Port 587 instead of 25. You can also check with Port 465. – ujas patel Nov 22 '11 at 05:35
0

From this messagge

A socket operation was attempted to an unreachable network 184.xx.xxx.xx:25

it seems that you cannot reach the SMTP address.

Check your internet connection and then check if the address is correct. A Ping to the address or a tracerout can help you understand why you cannot contact the server, if the address is correct

il_guru
  • 8,383
  • 2
  • 42
  • 51