Search code examples
javaemailsmtpgmailjakarta-mail

ssl false with port 465 does not throw exception for server smtp.gmail.com


I am trying to connect to my gmail account using com.sun.mail ..... Mail api. I am using mail api version 1.4.2 - mail_1.4.2.jar Now I am trying to connect with following details as :

username : [email protected]
password : some password (correct password)
host : smtp.gmail.com
port : 465
SSL : false

But when I try to execute Transport.connect(host,port,username,password), it just hangs -- no error return, no exception. Please help me out as if SSL is no then it should prompt me some error.

I am able to connect with SSl as true and rest of the configurations are same as above.


Solution

  • SSMTP is typically on port 465.

    SMTP is typically on port 25.

    Try again, but use port : 25. Google might enforce TLS/SSL on 465.