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


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Capture javamail error to file" Watch "Capture javamail error to file" New topic
Author

Capture javamail error to file

divya kundapur
Ranch Hand

Joined: Aug 21, 2007
Posts: 110

How can i store the javamail error to a file. I m sending mass email and would like to store the error when the email could not be delivered.


SCJP - 5.0
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

Just catch the exception thrown and log it into a file.


SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
divya kundapur
Ranch Hand

Joined: Aug 21, 2007
Posts: 110
Freddy Wong wrote:Just catch the exception thrown and log it into a file.


Thank you, i did that just now, but the issue now is, suppose i have one email id out of 5 which javamail was not able to deliver to, it does not write to the file which one it is. and also it does not send out mails to any of the other email ids.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39576
    
  27
If you need one-by-one error handling you may have to send out the mails individually, instead of all in one go.


Ping & DNS - updated with new look and Ping home screen widget
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19556
    
  16

Freddy Wong wrote:Just catch the exception thrown and log it into a file.

A logging framework like Log4J can really help with that. Using a FileAppender (possibly a RollingFileAppender), and using logger.error("message", exception) works like a charm.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Capture javamail error to file
 
Similar Threads
Suggestions on storing mail passwords safely
javamail jsp problem
JavaMail password store
Digital signatures
How do i store a folder of emails locally?