Bug 31869 - Allow DataHandler attachments in the attach tag
Summary: Allow DataHandler attachments in the attach tag
Alias: None
Product: Taglibs
Classification: Unclassified
Component: Mailer Taglib (show other bugs)
Version: 1.1
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2004-10-24 17:59 UTC by Jamie Flournoy
Modified: 2009-11-29 19:40 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Jamie Flournoy 2004-10-24 17:59:22 UTC
The 3 supported methods all have problems if you want to dynamically generate a
large personalized document without keeping it on the server indefinitely.
- Making a file means that you have to also develop a reliable method to delete
that file later (but not before the mail has been delivered, and not touching
any newer files that haven't been delivered yet).
- Using a URL means basically using a file, or setting up some sort of internet
server, and developing a mechanism to only allow the mailer to get it. That may
seem simple in a proof-of-concept setup but in a load balanced HTTPS world with
logins and privacy issues there's suddenly a bunch of extra overhead needed to
just attach a file without letting the whole world see it, without getting it
from the wrong server, etc.
- Putting the document inline doesn't work if the attachment is a big binary file.

The most direct and elegant way I can think of to solve this is just to pass a
DataHandler to the attach tag, so you can provide a unique in-memory copy of the
document you're generating and not need to clean anything up, not need to worry
about hostnames and protocols and ports and passwords, and you can pass anything
that JavaMail can handle in a message.

So, I would like to request that the attach tag be enhanced to take a
DataHandler instance - maybe by name of a bean in request scope, like this:

<mt:attach datahandler="myBigDocumentGenerator"/>

where myBigDocumentGenerator is a DataHandler of your own creation that's in
request scope.
Comment 1 Henri Yandell 2009-11-29 19:40:29 UTC
Resolving. Taglib has been retired.