20.4. Tags
Emails are generated using tags in the
http://jboss.com/products/seam/mail
namespace. Documents should always have the message
tag at the root of the message. The message tag prepares Seam to generate an email.
Facelets standard templating tags can be used as normal. Inside the
body
, you can use any JSF tag. If the tag requires access to external resources such as stylesheets or JavaScript, be sure to set the urlBase
.
- <m:message>
- Root tag of a mail message.
importance
— Sets the importance of the mail message. Valid values arelow
,normal
, orhigh
. Defaults tonormal
.precedence
— Sets the precedence of the message, for example,bulk
.requestReadReceipt
— If set, a read receipt request will be added, and the read receipt will be sent to theFrom:
address. Defaults tofalse
.urlBase
— If set, the value is prepended to therequestContextPath
, allowing you to use components such as<h:graphicImage>
in your emails.messageId
— Explicitly sets the Message-ID.
- <m:from>
- Sets the
From:
address for the email. Only one exists per email.name
— The name that the email comes from.address
— The email address that the email comes from.
- <m:replyTo>
- Sets the
Reply-to:
address for the email. Only one exists per email.address
— the email address the email comes from.
- <m:to>
- Adds a recipient to the email. Use multiple
<m:to>
tags for multiple recipients. This tag can be safely placed inside a repeat tag such as<ui:repeat>
.name
— The name of the recipient.address
— The email address of the recipient.
- <m:cc>
- Adds a CC recipient to the email. Use multiple
<m:cc>
tags for multiple CCs. This tag can be safely placed inside a iterator tag such as <ui:repeat>.name
— The name of the recipient.address
— The email address of the recipient.
- <m:bcc>
- Adds a BCC recipient to the email. Use multiple
<m:bcc>
tags for multiple bccs. This tag can be safely placed inside a repeat tag such as<ui:repeat>
.name
— The name of the recipient.address
— The email address of the recipient.
- <m:header>
- Adds a header to the email. (For example,
X-Sent-From: JBoss Seam
.)name
— The name of the header to add. (For example,X-Sent-From
.)value
— The value of the header to add. (For example,JBoss Seam
.)
- <m:attachment>
- Adds an attachment to the email.
value
— The file to attach:String
— AString
is interpreted as a path to file within the classpath.java.io.File
— An EL expression can reference aFile
object.java.net.URL
— An EL expression can reference aURL
object.java.io.InputStream
— An EL expression can reference anInputStream
. In this case both afileName
and acontentType
must be specified.byte[]
— An EL expression can reference abyte[]
. In this case both afileName
and acontentType
must be specified.
If the value attribute is ommitted:- If this tag contains a
<p:document>
tag, the document described will be generated and attached to the email. AfileName
should be specified. - If this tag contains other JSF tags, a HTML document will be generated from them and attached to the email. A
fileName
should be specified.
fileName
— Specifies the file name to use for the attached file.contentType
— Specifies the MIME type of the attached file.
- <m:subject>
- Sets the subject for the email.
- <m:body>
- Sets the body for the email. Supports an
alternative
facet which, if a HTML email is generated, can contain alternative text for a mail reader which doesn't support HTML.type
— If set toplain
, a plain text email will be generated. Otherwise, a HTML email is generated.