Jakarta Mailer Taglib 2.0
Tag mail


JSP tag <b>mt:mail</b> is used to construct an e-mail message. It is the root element of this tag library. <p/> mt:mail can have the following child tags: mt:addrecipient, mt:attach, mt:header, mt:part. <p/> The message will be sent unless the var attribute has been set.

Example:
<mt:mail subject="Test mail" from="john.doe@example.com"
    to="jane.doe@example.com" server="smtp.example.com">
    Hi Jane, here's my first mail
</mt:mail>

<mt:mail subject="Test mail" from="john.doe@example.com" server="smtp.example.com">
    <mt:addrecipient type="to">jane.doe@example.com</mt:addrecipient>
    Hi Jane, attached is the file you requested.
    <mt:attach file="c:/work/document.doc"/>
</mt:mail>

<mt:mail subject="Test mail" from="john.doe@example.com"
    to="jane.doe@example.com" server="smtp.example.com"
    type="multipart/alternative">
    <mt:part type="text/plain">
        Hi Jane, here's the plain text version of the mail.
    </mt:part>
    <mt:part type="text/html">
        <html>
        <head>
        <style type="text/css">
            h1 { color: red; }
            body {
                background-repeat: no-repeat;
                background-position: left top;
                margin-top: 100px;
                background-image: url(cid:jakarta-logo.gif);
            }
        </style>
        <title>HTML Version</title>
        </head>
        <body>
            <h1>Hi Jane,</h1>
            Here's the HTML version of the same mail
        </body>
        </html>
        <mt:attach url="http://jakarta.apache.org/images/jakarta-logo.gif"/>
    </mt:part>
</mt:mail>

Note: the use of the cid: URL scheme to access an embedded logo in an HTML formatted mail message
        


Tag Information
Tag Classorg.apache.taglibs.mailer2.MailTag
TagExtraInfo ClassNone
Body ContentJSP
Display Namemt:mail

Attributes
NameRequiredRequest-timeTypeDescription
fromnoyesjava.lang.StringThe e-mail address from whom the message is sent, or set the context-param org.apache.taglibs.mailer2.from
subjectnoyesjava.lang.StringThe subject of the e-mail message
tonoyesjava.lang.StringThe e-mail address to send the message to
ccnoyesjava.lang.StringThe e-mail address to send the message to as cc
bccnoyesjava.lang.StringThe e-mail address to send the message to as bcc
replytonoyesjava.lang.StringThe e-mail address to reply-to
importancenoyesjava.lang.StringThe importance of the message, either "low", "normal" or "high"
typenoyesjava.lang.StringThe Content-Type of the message, default "text/plain"
encodingnoyesjava.lang.StringThe character set encoding of the message
backgroundnoyesjava.lang.StringWhether the mail should be sent in a background thread, default true. If true then no feedback (e.g. exceptions) will be returned to the user. ServletContext.log() is used instead
mimemessagenonojava.lang.StringThe name of a JNDI lookup javax.mail.internet.MimePartDataSource
sessionnoyesjava.lang.StringThe name of a JNDI lookup javax.mail.Session
servernoyesjava.lang.StringThe name of the mail server, default localhost, or set the context-param org.apache.taglibs.mailer2.server
portnoyesintThe port of the mail server, default 25, or set the context-param org.apache.taglibs.mailer2.port
usernamenoyesjava.lang.StringThe username to use with PLAIN or LOGIN SMTP authentication, or set the context-param org.apache.taglibs.mailer2.username
passwordnoyesjava.lang.StringThe password to use with PLAIN or LOGIN SMTP authentication, or set the context-param org.apache.taglibs.mailer2.password
varnonojava.lang.StringName of variable to store message in the scope indicated by the scope attribute, instead of sending it directly
scopenoyesjava.lang.StringScope to store message in instead of sending it directly, either "page" (default), "request", "session", or "application"

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.