aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes JavaMail and Gmail Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "JavaMail and Gmail" Watch "JavaMail and Gmail" New topic
Author

JavaMail and Gmail

Khushbu Arora
Greenhorn

Joined: May 20, 2010
Posts: 3
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

Joined: Oct 27, 2005
Posts: 19720
    
  20

Please UseCodeTags. You can use the edit button to add them.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

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

Joined: May 20, 2010
Posts: 3
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
Marshal

Joined: Mar 22, 2005
Posts: 42286
    
  64
It would help if you posted the complete error messages with their respective stack traces.


Ping & DNS - my free Android networking tools app
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19720
    
  20

Have you already read How do I access Gmail with JavaMail?
Khushbu Arora
Greenhorn

Joined: May 20, 2010
Posts: 3
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

Joined: Apr 01, 2009
Posts: 645
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
 
subject: JavaMail and Gmail