Jakarta Mailer Taglib 2.0
Tag attach


JSP tag <b>mt:attach</b> is used to add attachments. <p/> It is a child of mt:mail or mt:part. <p/> Either the url, or the file, or the message or both name and type attributes should be present. If the url attribute is present, the name and type are derived from the HTTP response. If the filename attribute is present, the name and type are also automatically derived. If the message attribute is present, the type is "message/rc822" and the name is the subject of the attached message. If both name and type are present, the body content of the tag is added as an attachment.

Example:
<mt:attach file="c:/temp/example.txt"/>

<mt:attach url="http://jakarta.apache.org/images/jakarta-logo.gif"/>

<mt:attach type="text/plain" name="First Attachment" encoding="utf-8">
    This is the content of the first attachment. It contains utf-8 cháràctërs.
</mt:attach>

<mt:mail var="attachment1" from="john.doe@example.com" subject="First Mail">
    <mt:addrecipient type="to">jane.doe@example.com</mt:addrecipient>
    First mail
    </mt:mail>
<mt:mail var="attachment2" from="jane.doe@example.com" subject="Second Mail">
    <mt:addrecipient type="to" address="john.doe@example.com"/>
    Second mail
</mt:mail>
<mt:mail from="digest@example.com" subject="Digest of two messages" type="multipart/digest">
    <mt:addrecipient type="to" name="Digest User">digest@example.com</mt:addrecipient>
    <mt:attach message="${attachment1}"/>
    <mt:attach message="${attachment2}"/>
</mt:mail>
        


Tag Information
Tag Classorg.apache.taglibs.mailer2.AttachTag
TagExtraInfo ClassNone
Body ContentJSP
Display Namemt:attach

Attributes
NameRequiredRequest-timeTypeDescription
filenamenoyesjava.lang.StringThe name of a local file to attach to the part or mail
urlnoyesjava.lang.StringThe url of a external resource to attach to the part or mail
typenoyesjava.lang.StringThe content-type of the body content of the attachment
namenoyesjava.lang.StringThe name of the attachment; this is the name under which the attachment can be saved
encodingnoyesjava.lang.StringThe encoding of the attachment, default unspecified
messagenoyesjavax.mail.internet.MimeMessageA Message object stored with a previous &lt;mt:mail var="..."&gt;

Variables
No Variables Defined.


Output Generated by Tag Library Documentation Generator. Java, JSP, and JavaServer Pages are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries. Copyright 2002-4 Sun Microsystems, Inc. 4150 Network Circle Santa Clara, CA 95054, U.S.A. All Rights Reserved.