aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes Javamail and DSN 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 "Javamail and DSN" Watch "Javamail and DSN" New topic
Author

Javamail and DSN

Thomas Calcagno
Greenhorn

Joined: May 30, 2011
Posts: 3
Hi everybody,

I'm using Javamail to send e-mails to administrator of an application, with a copy to the interested user. These e-mails are sent with a technical address, so when the primary recipient turns to be invalid (it could occur), only the technical address receives the failed delivery notification.
I want the copy address(es) to receive this notification as well.

I found the DSN package of javamail:
http://javamail.kenai.com/nonav/javadocs/com/sun/mail/dsn/package-summary.html

But the way it works is quite nebulous for me, especially the DeliveryStatus class.
Does some of you guys already used this package? Or have a link to some example/tutorial. I failed to find something interesting...

Thanks,
Tom
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18991
    
    8

The description of the package in that documentation says:
Support for creating and parsing Delivery Status Notifications.

So, if you get a DSN then you can parse it using code from this package. Or if you're writing a mail server, you could use code from this package to create a DSN.

You'll notice it doesn't mention anything about requesting a DSN, which is what your question is about. So you're looking in the wrong place; except that the documentation does provide links to the RFCs which specify DSNs. One or both of them (I read them but don't remember which) describes how to change your e-mail message so that you're more likely to get a DSN.
Thomas Calcagno
Greenhorn

Joined: May 30, 2011
Posts: 3
Thanks for the clarifications Paul.

As you have some experience on this subject, do you know if it is possible to request multiple recipients for the DSN by working at the MIME level only? Or does it require to act at the MTA level?

I will have a better look at the RFCs tomorrow but it would be great if you could point me to the right direction
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18991
    
    8

Unfortunately my experience consists of only a couple of hours perusing the RFCs and trying a few modifications to our existing e-mail-sending code. So I don't have an answer to that specific question. Sorry.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42944
    
  68
I am fairly certain that you can only specify a single address to send a DSN to. If you search these forums for DSN posts made by me you will find pointers to helpful material.
Thomas Calcagno
Greenhorn

Joined: May 30, 2011
Posts: 3
For what I read, you are right Ulf.

I looked for a way to change the recipient of the DSN - to set the copy address as the recipient instead of the "from" address - at the message level but it seems it is not possible, as DSN mechanisms are handled at MTA level.
Then I looked for an equivalent to the RRT header but found nothing.

I will look for another way, for instance sending the e-mail on behalf of the user which need to receive the failed delivery notification.

Regards,
Tom
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Javamail and DSN