.net - SMTP send email failure by SmtpClinet (SmarterEmail server) -
i have configured , running smarteremail server, running smtp service 25 port, configured email account.
i've created simple .net application send email email server, 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 exception:
unhandled exception: system.net.mail.smtpexception: failure sending mail. ---> s ystem.net.webexception: unable connect remote server ---> system.net.s ockets.socketexception: connection attempt failed because connected party did not respond after period of time, or established connection faile d because connected host has failed respond 173.248.182.102:25 @ system.net.sockets.socket.doconnect(endpoint endpointsnapshot, socketaddre ss socketaddress) @ 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 --- @ system.net.servicepoint.getconnection(pooledstream pooledstream, object ow ner, boolean async, ipaddress& address, socket& abortsocket, socket& abortsocket 6, int32 timeout) @ system.net.pooledstream.activate(object owningobject, boolean async, int32 timeout, generalasyncdelegate asynccallback) @ system.net.pooledstream.activate(object owningobject, generalasyncdelegate asynccallback) @ system.net.connectionpool.getconnection(object owningobject, generalasyncd elegate asynccallback, int32 creationtimeout) @ system.net.mail.smtpconnection.getconnection(servicepoint servicepoint) @ system.net.mail.smtptransport.getconnection(servicepoint servicepoint) @ system.net.mail.smtpclient.getconnection() @ system.net.mail.smtpclient.send(mailmessage message) --- end of inner exception stack trace --- @ system.net.mail.smtpclient.send(mailmessage message) @ 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 @ 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. not work (local) machine.
in same time, if copy application machine smarteremail (remote) running, works!
i thought blocked firewall, enabled 25 on remote machine - same result. disabled firewall, both locally , remote machine - same result.
additional diagnostic:
run smtp test 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 authenticate debug smtp: check mechanisms: login plain digest-md5 ntlm auth login 334 vxnlcm5hbwu6 c3vwcg9yda== 334 ugfzc3dvcmq6 c3vwcg9yddeymw== 235 authentication successful
it says smtp ok.
telnet machine:
microsoft telnet> o mail.trackyt.net 25 connecting mail.trackyt.net...could not open connection host, on port 25: connect failed
same telnet smartermail machine ok.
any ideas ?
are doing home? lot of isps block outgoing port 25.
in smartermail can add smtp listener port. try adding 1 587, , see if can connect (assuming have admin rights this).
--dave
Comments
Post a Comment