• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JavaMail and Gmail

 
Khushbu Arora
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • 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=





 
Rob Spoor
Sheriff
Pie
Posts: 20393
47
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please UseCodeTags. You can use the edit button to add them.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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?

 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It would help if you posted the complete error messages with their respective stack traces.
 
Rob Spoor
Sheriff
Pie
Posts: 20393
47
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you already read How do I access Gmail with JavaMail?
 
Khushbu Arora
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Mark E Hansen
Ranch Hand
Posts: 650
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic