This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Other JSE/JEE APIs and the fly likes problem in sending mail Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "problem in sending mail" Watch "problem in sending mail" New topic
Author

problem in sending mail

Saravanan Thirugnanam
Greenhorn

Joined: Jan 19, 2005
Posts: 20
Hi all,

I am trying to write a simple java program to send email using JavaMail API.
I have put mail.jar in my class path and used the following code for the same.



When i try to compile the above code , i get the following compilation error.




I can not understand why this error is coming.i manually tested the connectivity with our mail server using ping utility.But i am not sure why i am not able to connect to port 25(SMTP) . Can any body predict why this error is coming and suggest a solution?


saravanan T
Jignesh Patel
Ranch Hand

Joined: Nov 03, 2001
Posts: 626

Your code is correct.
You need to talk to admin person to check whether your machine is allowed to send mail.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


i manually tested the connectivity with our mail server using ping utility.But i am not sure why i am not able to connect to port 25(SMTP)

Can you telnet to that machine on that port?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Saravanan Thirugnanam
Greenhorn

Joined: Jan 19, 2005
Posts: 20

Can you telnet to that machine on that port


No, when i try to telnet to that machine on port 25 , it is not connected.But if i use ping utility to test connection with that machine it is giving reply.

My machine is connected to internet through proxy server.Is this a problem in sending mail?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41052
    
  43
Ping just checks that the machine is up and running, and listening to the network. If you can't connect to port 25, that port may be blocked somewhere in between, or the mail server is down or doesn't accept connections from the machine you're trying this from.
You said that your mail client running on the same machine does not have problems connecting to that machine? That would be odd indeed.


Ping & DNS - my free Android networking tools app
Saravanan Thirugnanam
Greenhorn

Joined: Jan 19, 2005
Posts: 20
You said that your mail client running on the same machine does not have problems connecting to that machine?


yes, A mail client(Lotus Notes) is running in the same machine which is connected to that machine through which we send and receive our corporate mails. But i can not programmatically connect to that machine on port 25.
Do i need to do any configuration in mail server to accept connection from my machine or is there any problem in sending mails from a system which is behind the firewalls?
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Check your Notes client configuration. Somewhere it is likely to describe its connection parameters (sorry, can't suggest where - I haven't used Notes in six years). Perhaps you are connecting to the wrong machine, or there are extra authentication steps needed.

(Long shot: make sure your email server is running Domino 4.5 or above, previous versions didn't support SMTP)
Seetesh Hindlekar
Ranch Hand

Joined: Feb 13, 2004
Posts: 244
Hello,

The port 25 is usually blocked by the SMTP/POP3 server and checkbox is usually set. Tell your Administrator to uncheck this. Normally this port is blocked as part of the 6 port blocking rules as set in the virusscan console of the POP3/SMTP Server for your IP address/machine.

Even if you uncheck the box, it re-checks the status of blocking this port after a pre-determined time.

The process has to be repeated after every "n" hours or so.

Rgds,

Seetesh
Malin Ljungh
Greenhorn

Joined: Sep 27, 2005
Posts: 1
Hi,

I have the exact same problem.
I have also verified that I can send email through my SMTP server on port 25 using Outlook - but not programatically using Java :-(

Did you solve this?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem in sending mail
 
Similar Threads
urgent help in java mail
JSP using javamail
using google to send email by JavaMail
Java Mail Authentication
Error while running a simple java mail application