Results 1 to 5 of 5
Thread: Check SMTP server status
- 04-01-2010, 03:07 AM #1
Member
- Join Date
- Mar 2010
- Posts
- 7
- Rep Power
- 0
- 04-01-2010, 03:49 AM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Did you read JavaMail API?
You don't want to actually send the email, you can open a TCP socket to port number 25 of your mail server and send the separate commands to subject, mail from/to. Something like this,
TestMail your_domain.com
From: youre_mail@your_domain.com
To: recipient@recipient_domain.com
And then check each response. If you didn't get any error, means that your mail server is working fine.
- 04-01-2010, 04:31 AM #3
Member
- Join Date
- Mar 2010
- Posts
- 7
- Rep Power
- 0
Actually i want to send email using JavaMail API but before that i just want to have a method which returns true/false depending on the smtp server status.
- 04-01-2010, 11:40 PM #4
Senior Member
- Join Date
- Dec 2009
- Location
- Belgrade, Serbia
- Posts
- 364
- Rep Power
- 4
You can send mail as 2 step process.
1. step - connect to server
2. step - send message
On first step:
"Usually, when you get a low level SocketException when connecting, the problem is due to your networking configuration. Usually it's not a Java problem." (from JavaMail API FAQ)
So don't use ordinary
Transaport.send ()
try different connection problems scenarios and use something like this:
Java Code:Transport t = session.getTransport(protocol); try { t.connect(username, password); } catch(SocketException e){ } try { t.sendMessage(msg, msg.getAllRecipients() } catch(Exception e) {}
and be sure u use
in your code when performing this tests!Java Code:session.setDebug(true); // Verbose!
regardsLast edited by FON; 04-01-2010 at 11:43 PM. Reason: more comments
- 04-02-2010, 05:45 PM #5
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Similar Threads
-
javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port:
By nikunj.prmr@gmail.com in forum Advanced JavaReplies: 2Last Post: 08-24-2011, 04:32 PM -
Check SMTP server status
By sandeep.ctg in forum Java ServletReplies: 0Last Post: 03-31-2010, 08:10 AM -
Check LAN connection status through JAVA
By shanmathi in forum Advanced JavaReplies: 1Last Post: 04-09-2009, 03:19 PM -
smtp server configuration with jboss server
By vilas_patil in forum Java ServletReplies: 0Last Post: 01-05-2009, 01:18 PM -
Readind email from smtp server
By pzkhan in forum Advanced JavaReplies: 0Last Post: 02-10-2008, 07:57 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks