{"id":7441,"date":"2014-06-19T03:57:48","date_gmt":"2014-06-19T03:57:48","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/06\/19\/javamail-smtp-live-com-timeout-in-ubuntu-collection-of-common-programming-errors\/"},"modified":"2014-06-19T03:57:48","modified_gmt":"2014-06-19T03:57:48","slug":"javamail-smtp-live-com-timeout-in-ubuntu-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/06\/19\/javamail-smtp-live-com-timeout-in-ubuntu-collection-of-common-programming-errors\/","title":{"rendered":"javamail smtp.live.com timeout in ubuntu-Collection of common programming errors"},"content":{"rendered":"<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/7c5c54b8b7089caf7326e77cb69ba562?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nVitor Mendes<\/p>\n<p>I am having a problem with JavaMail. When I try to send an e-mail from localhost (always using tomcat7) with the configurations below:<\/p>\n<pre><code>\n    \n    \n    \n    \n    \n        \n            smtp\n            true\n            true\n            true\n            10000\n        \n    \n\n<\/code><\/pre>\n<p>The e-mail is sent, getting the following with DEBUG:<\/p>\n<pre><code>DEBUG: JavaMail version 1.4.3\nDEBUG: successfully loaded resource: \/META-INF\/javamail.default.providers\nDEBUG: Tables of loaded providers\nDEBUG: Providers Listed By Class Name: {com.sun.mail.smtp.SMTPSSLTransport=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc], com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc], com.sun.mail.imap.IMAPSSLStore=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc], com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc]}\nDEBUG: Providers Listed By Protocol: {imaps=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc], imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], smtps=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc], pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc], pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]}\nDEBUG: successfully loaded resource: \/META-INF\/javamail.default.address.map\nDEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]\nDEBUG SMTP: useEhlo true, useAuth true\nDEBUG SMTP: trying to connect to host \"smtp.live.com\", port 587, isSSL false\n220 BLU0-SMTP55.phx.gbl Microsoft ESMTP MAIL Service, Version: 6.0.3790.4675 ready at  Mon, 17 Mar 2014 06:40:21 -0700 \nDEBUG SMTP: connected to host \"smtp.live.com\", port: 587\n\nEHLO 192.168.2.4\n250-BLU0-SMTP55.phx.gbl Hello [186.247.127.93]\n250-TURN\n250-SIZE 41943040\n250-ETRN\n250-PIPELINING\n250-DSN\n250-ENHANCEDSTATUSCODES\n250-8bitmime\n250-BINARYMIME\n250-CHUNKING\n250-VRFY\n250-TLS\n250-STARTTLS\n250 OK\nDEBUG SMTP: Found extension \"TURN\", arg \"\"\nDEBUG SMTP: Found extension \"SIZE\", arg \"41943040\"\nDEBUG SMTP: Found extension \"ETRN\", arg \"\"\nDEBUG SMTP: Found extension \"PIPELINING\", arg \"\"\nDEBUG SMTP: Found extension \"DSN\", arg \"\"\nDEBUG SMTP: Found extension \"ENHANCEDSTATUSCODES\", arg \"\"\nDEBUG SMTP: Found extension \"8bitmime\", arg \"\"\nDEBUG SMTP: Found extension \"BINARYMIME\", arg \"\"\nDEBUG SMTP: Found extension \"CHUNKING\", arg \"\"\nDEBUG SMTP: Found extension \"VRFY\", arg \"\"\nDEBUG SMTP: Found extension \"TLS\", arg \"\"\nDEBUG SMTP: Found extension \"STARTTLS\", arg \"\"\nDEBUG SMTP: Found extension \"OK\", arg \"\"\nSTARTTLS\n220 2.0.0 SMTP server ready\nEHLO 192.168.2.4\n250-BLU0-SMTP55.phx.gbl Hello [191.223.124.12]\n250-TURN\n250-SIZE 41943040\n250-ETRN\n250-PIPELINING\n250-DSN\n250-ENHANCEDSTATUSCODES\n250-8bitmime\n250-BINARYMIME\n250-CHUNKING\n250-VRFY\n250-AUTH LOGIN PLAIN XOAUTH2\n250 OK\nDEBUG SMTP: Found extension \"TURN\", arg \"\"\nDEBUG SMTP: Found extension \"SIZE\", arg \"41943040\"\nDEBUG SMTP: Found extension \"ETRN\", arg \"\"\nDEBUG SMTP: Found extension \"PIPELINING\", arg \"\"\nDEBUG SMTP: Found extension \"DSN\", arg \"\"\nDEBUG SMTP: Found extension \"ENHANCEDSTATUSCODES\", arg \"\"\nDEBUG SMTP: Found extension \"8bitmime\", arg \"\"\nDEBUG SMTP: Found extension \"BINARYMIME\", arg \"\"\nDEBUG SMTP: Found extension \"CHUNKING\", arg \"\"\nDEBUG SMTP: Found extension \"VRFY\", arg \"\"\nDEBUG SMTP: Found extension \"AUTH\", arg \"LOGIN PLAIN XOAUTH2\"\nDEBUG SMTP: Found extension \"OK\", arg \"\"\nDEBUG SMTP: Attempt to authenticate\nDEBUG SMTP: check mechanisms: LOGIN PLAIN DIGEST-MD5 NTLM \nAUTH LOGIN\n334 dadADASDAe21\nJAMre5LygCDrQGFlcm9isKAlvd0=\n334 asdADSdasr32\naSFASFwqFqwF9f3FASf221F==\n235 2.7.0 Authentication succeeded\nDEBUG SMTP: use8bit false\nMAIL FROM:&lt; mail@mydomain.com&gt;\n250 2.1.0 mail@mydomain.com....Sender OK\nRCPT TO:&lt; anothermail@mydomain.com&gt;\n250 2.1.5 anothermail@mydomain.com \nDEBUG SMTP: Verified Addresses\nDEBUG SMTP:   anothermail@mydomain.com\nDATA\n354 Start mail input; end with .\nDate: Mon, 17 Mar 2014 10:40:55 -0300 (BRT)\nFrom: mail@mydomain.com\nTo: anothermail@mydomain.com\nMessage-ID: \nSubject: MESSAGE SUBJECT\nMIME-Version: 1.0\nContent-Type: multipart\/mixed; \n    boundary=\"----=_Part_0_1681003437.1395063614295\"\n\n------=_Part_0_1681003437.1395063614295\nContent-Type: multipart\/related; \n    boundary=\"----=_Part_1_11750387.1395063614333\"\n\n------=_Part_1_11750387.1395063614333\nContent-Type: text\/html; charset=us-ascii\nContent-Transfer-Encoding: 7bit\n\nAN HTML MESSAGE\n------=_Part_1_11750387.1395063614333--\n\n------=_Part_0_1681003437.1395063614295--\n.\n250 2.6.0   Queued mail for delivery\nQUIT\n221 2.0.0 BLU0-SMTP55.phx.gbl Service closing transmission channel\n<\/code><\/pre>\n<p>The problem is, when I compile and send to my Ubuntu server, I get the following error:<\/p>\n<pre><code>DEBUG: Providers Listed By Protocol: {imaps=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc], imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], smtps=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc], pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc], pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]}\nDEBUG: successfully loaded resource: \/META-INF\/javamail.default.address.map\nDEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]\nDEBUG SMTP: useEhlo true, useAuth true\nDEBUG SMTP: trying to connect to host \"smtp.live.com\", port 587, isSSL false\ncatching error with stack trace:\norg.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.MessagingException: Could not connect to SMTP host: smtp.live.com, port: 587;\n  nested exception is:\n    java.net.ConnectException: Connection timed out. Failed messages: javax.mail.MessagingException: Could not connect to SMTP host: smtp.live.com, port: 587;\n  nested exception is:\n    java.net.ConnectException: Connection timed out; message exception details (1) are:\nFailed message 1:\njavax.mail.MessagingException: Could not connect to SMTP host: smtp.live.com, port: 587;\n  nested exception is:\n    java.net.ConnectException: Connection timed out\n    at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1706)\n    at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:525)\n    at javax.mail.Service.connect(Service.java:291)\n    at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:389)\n    at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:340)\n    at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:355)\n    at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:344)\n    at com.mydomain.model.general.Mailer$2.run(Mailer.java:48)\n    at java.lang.Thread.run(Thread.java:679)\nCaused by: java.net.ConnectException: Connection timed out\n    at java.net.PlainSocketImpl.socketConnect(Native Method)\n    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:327)\n    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:193)\n    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:180)\n    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:384)\n    at java.net.Socket.connect(Socket.java:546)\n    at java.net.Socket.connect(Socket.java:495)\n    at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:284)\n    at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:227)\n    at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1672)\n    ... 8 more\n<\/code><\/pre>\n<p>Does anybody have any idea on how I can solve this??<\/p>\n<p>Thanks!<\/p>\n<\/li>\n","protected":false},"excerpt":{"rendered":"<p>Vitor Mendes I am having a problem with JavaMail. When I try to send an e-mail from localhost (always using tomcat7) with the configurations below: smtp true true true 10000 The e-mail is sent, getting the following with DEBUG: DEBUG: JavaMail version 1.4.3 DEBUG: successfully loaded resource: \/META-INF\/javamail.default.providers DEBUG: Tables of loaded providers DEBUG: Providers [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-7441","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7441","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=7441"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7441\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=7441"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=7441"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=7441"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}