• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

JavaMail and Gmail

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!

The program of JavaMail to send email by using gmail SMTP server was working correctly in Windows 7. When I tested the program in Windows XP in a different machine, then the email is not going. Either Messaging or SendMail exception comes. I have used JDK1.6 and NetBeans 5.5 in both the machines.

Kindly let me know whether the problem is because of change of OS (in which case some changes in coding may be needed) or some setting needs to be done in NetBeans, which was taken automatically in Windows 7.

The code is=





 
Sheriff
Posts: 22839
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please UseCodeTags. You can use the edit button to add them.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And correct the indentation.

Also, please see ItDoesntWorkIsUseless: what's actually happening? Are the same ports open on both machines? Are the machine's firewall/etc. settings the same?
 
Khushbu Arora
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm getting MessagingException and SendFailedException. How to check for the opened ports in Windows? In Windows XP, I have disabled firewall but its enabled with few settings in Windows 7. In spite of the fact that firewall is enabled in Win 7, there are no issues with the program. On the contrary, disabling the firewall in Windows XP didn't solve my problem.

I think the issue is with the ports only. Can you please help me in finding out the closed ports in Win? For gmail smtp server (since I'm sending and receiving messages in gmail only through my application), what should be the port number to be checked?

 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It would help if you posted the complete error messages with their respective stack traces.
 
Rob Spoor
Sheriff
Posts: 22839
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you already read How do I access Gmail with JavaMail?
 
Khushbu Arora
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Following exception is generated:

javax.mail.MessagingException: can't determine local email address




Yes, I've already gone through that text but the code which I wrote is already working in one machine with Win 7. So, I think the issue should not be with the code only.
 
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Khushbu Arora wrote:Following exception is generated:

javax.mail.MessagingException: can't determine local email address




Yes, I've already gone through that text but the code which I wrote is already working in one machine with Win 7. So, I think the issue should not be with the code only.


That, Sir, is a very dangerous assumption. Just because some code works in one environment doesn't mean the code is correct. If you close yourself off to possibilities which other, possibly more experienced developers are pointing out to you, you run the risk of never solving your problem.
 
reply
    Bookmark Topic Watch Topic
  • New Topic