aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes Java mail : getting response from smtp server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Java mail : getting response from smtp server" Watch "Java mail : getting response from smtp server" New topic
Author

Java mail : getting response from smtp server

abhi gupta
Greenhorn

Joined: Dec 15, 2005
Posts: 20
I am having a mail sending class which sends the mail using SMTP server. I am sending the mail using the java mail api to connect to smtp server and send it using the method:

msg.setSubject(subject);
msg.setContent(multipart);
transport.sendMessage(msg, msg.getAllRecipients());
transport.close();

Can you guide me if there is any way in which i can get the report (containing status) of all the mails sent in a period of time. i.e. for example: say in last 1 hour. If there is pointer to code available for it, then it would be great!!
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18907
    
    8

Such reports are not part of the SMTP specification. It's possible you might be able to get such a report from your server, but you wouldn't use JavaMail to do that. Or you could insert your own code to keep track of when you sent the messages. Again that's nothing to do with JavaMail, just some regular database code that you would write.

And what do you mean by "status"?
[ January 28, 2008: Message edited by: Paul Clapham ]
abhi gupta
Greenhorn

Joined: Dec 15, 2005
Posts: 20
Hi Paul,

Thanks! for your quick response.

By 'Status', I mean is there a way by which I can track whether my mails have been sent successfully or not in a specified period of time, say 1 hr.

I can recieve the response from server using "SMTPTransport.getLastServerResponse()", but this would be giving me the response per mail. My requirement is to get a consolidated report from server of all the mails being sent.

Thanks!!
Abhishek
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18907
    
    8

Oh, I see. Then you would have to see what the server provides in the way of reports. Don't expect it to have a Java API though.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java mail : getting response from smtp server