Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem in sending mail

 
Saravanan Thirugnanam
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Jignesh Patel
Ranch Hand
Posts: 626
Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your code is correct.
You need to talk to admin person to check whether your machine is allowed to send mail.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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?
 
Saravanan Thirugnanam
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Saravanan Thirugnanam
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic