SMTP send email failure by SmtpClinet (SmarterEmail server)

I have configured and running SmarterEmail server, running SMTP service for 25 port, configured email account.

I've created simple .NET application to send email by my Email server, it is really simple:

        public void SendEmail(EmailMessage message, string username, string password, string host, int port, bool enableSsl)
    {
        MailMessage mm = new MailMessage(message.From, message.To, message.Subject, message.Message);
        NetworkCredential credentials = new NetworkCredential(username, password);

        SmtpClient sc = new SmtpClient(host, 25);
        sc.DeliveryMethod = SmtpDeliveryMethod.Network;
        sc.UseDefaultCredentials = false;
        sc.EnableSsl = enableSsl;
        sc.Credentials = credentials;

        sc.Send(mm);
    }

This application failed with exception:

Unhandled Exception: System.Net.Mail.SmtpException: Failure sending mail. ---> S ystem.Net.WebException: Unable to connect to the remote server ---> System.Net.S ockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection faile d because connected host has failed to respond 173.248.182.102:25 at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddre ss socketAddress) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Sock et 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 ow ner, 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(ServicePoint servicePoint) at System.Net.Mail.SmtpTransport.GetConnection(ServicePoint servicePoint) 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 SendMail.MailService.SendEmail(EmailMessage message, String username, Stri ng password, String host, Int32 port, Boolean enableSsl) in D:\Development\Proje cts\Experiments\SendMail\SendMail\Program.cs:line 36 at SendMail.Program.Main(String[] args) in D:\Development\Projects\Experiment s\SendMail\SendMail\Program.cs:line 52

Mail server: mail.trackyt.net, port = 25, SSL = false. It does not work from my (local) machine.

In the same time, if I copy this application to machine were SmarterEmail (remote) is running, it successfully works!

I thought it blocked by Firewall, enabled 25 on remote machine - same result. Disabled Firewall, both locally and remote machine - same result.

Additional diagnostic:

Run SMTP test by http://pingability.com/smtptest.jsp:

EHLO pingability.com 250-MAST-WIN2K8R2-STD Hello [207.210.209.134] 250-SIZE 31457280 250-AUTH LOGIN CRAM-MD5 250 OK DEBUG SMTP: Found extension "SIZE", arg "31457280" DEBUG SMTP: Found extension "AUTH", arg "LOGIN CRAM-MD5" DEBUG SMTP: Found extension "OK", arg "" DEBUG SMTP: Attempt to authenticate DEBUG SMTP: check mechanisms: LOGIN PLAIN DIGEST-MD5 NTLM AUTH LOGIN 334 VXNlcm5hbWU6 c3VwcG9ydA== 334 UGFzc3dvcmQ6 c3VwcG9ydDEyMw== 235 Authentication successful

It says that SMTP is OK.

Telnet from my machine:

Microsoft Telnet> o mail.trackyt.net 25 Connecting To mail.trackyt.net...Could not open connection to the host, on port 25: Connect failed

Same telnet from SmarterMail machine is OK.

Any ideas ?

Answers


Are you doing this from home? A lot of ISPs block outgoing port 25.

In smartermail you can add a SMTP listener for another port. Try adding one for 587, and see if you can connect to it (assuming you have admin rights to do this).

--dave


Need Your Help

Nodejs: How to handle event listening between objects?

node.js javascript-events module publish-subscribe commonjs

I currently have the problem that I have an object which should listen on another object.

Activiti Forms, initial value for form property

java jbpm activiti

I'm using activiti 5.9 and I want to be able to set initial value for an specific form property.