• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Gmail and port 465 vs. port 587

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've been testing some code for sending secure e-mail, and I've been using my Gmail account for testing. I've done a lot of googling on the subject of Java and secure SMTP access, and found a lot of specific example regarding Gmail in particular.

I've got code that works now, but I'm a bit puzzled. In order to make my code work, I MUST use port 465. I cannot get the code to work if I try to access Gmail using port 587, even though that's the recommended port and the one that I've always used to configure an e-mail client like Mac OS X Mail or Mozilla.

In the googling I've done, I've seen stories of success and failure, and I've seen examples with both ports used. The successful code seems to be using port 465, but I've never heard the particular port used mentioned as an important ingredient for success. In fact, to the minimal degree I've heard the port discussed at all, it's been to say "use either one, it doesn't matter."

This leaves me feeling that there's something missing in my code -- I'd think that if everything were in order, port 587 would also work for me. Further, while port 465 does work, in the debug trace I see "isSSL false", even though I'm specifying an SSL socket factory and am pretty sure that SSL is being used.

Here's a portion of the debug log where I fail using port 587:



What's all this about a "plaintext connection"? Why does it say, both here and below when my connection succeeded "isSSL false"? I experimented with the SMTPSSLTransport class, which gave me the more comforting "isSSL true", but my results didn't change one bit.

Here's a portion of the debug log where I succeed using port 465:



And for any light it might shed on the situation, here's an edited-down version of my code:

 
He repaced his skull with glass. So you can see his brain. Kinda like this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic