Advanced Customization > Info*Engine User’s Guide > Task Webject Reference > Message Webjects > Send-Mail
  
Send-Mail
Creates and sends an email message. Send-Mail supports designation of primary, copy, and blind copy recipients, as well as message subject and message bodies. It can create and send multi-part MIME messages containing a mixture of message body part types. It allows message body parts to be specified as simple text using webject parameters or as BLOBs using the task input stream.
SYNTAX
<ie:webject name="Send-Mail" type="MSG">
  <ie:param name="BCC" data="e-mail_address"/>
  <ie:param name="BLOB_COUNT" data="number"/>
  <ie:param name="CC" data="e-mail_address"/>
 <ie:param name="CONNECTION_TIMEOUT" data="milliseconds"/>
  <ie:param name="CONTENT" data="message_body"/>
  <ie:param name="CONTENT_TYPE" data="MIME_type"/>
  <ie:param name="CONTENT_URL_LANGUAGE" data="
  <ie:param name="DBUSER" data="username"/>
  <ie:param name="FROM" data="e-mail_address"/>
  <ie:param name="GROUP_OUT" data="results"/>
  <ie:param name="HEADERS_CHARSET" data="
  <ie:param name="MAIL_SERVER" data="host_name"/>
  <ie:param name="MAX_DELIVERY_TIME" data="
  <ie:param name="MULTIPART_TYPE" data="
  <ie:param name="PASSWD" data="password"/>
  <ie:param name="PASSWORD" data="password"/>
  <ie:param name="REPLY_TO" data="e-mail_address"/>
  <ie:param name="SUBJECT" data="message_subject"/>
<ie:param name="TIMEOUT" data="milliseconds"/>
  <ie:param name="TO" data="e-mail_address"/>
  <ie:param name="USERNAME" data="user_name"/>
</webject>
PARAMETERS
Required
Select
Optional
TO
BLOB_COUNT
CC
CONNECTION_TIMEOUT
CONTENT
BCC
CONTENT_LINE_BREAK
DBUSER
CONTENT_TYPE
FROM
CONTENT_URL
GROUP_OUT
HEADER
HEADERS_CHARSET
MAIL_SERVER
MAX_DELIVERY_TIME
MULTIPART_TYPE
PASSWD
PASSWORD
REPLY_TO
SUBJECT
TIMEOUT
USERNAME
BCC
The email addresses of the blind copy recipients of the message. Each of these recipients receives a copy of the message, but none of these addresses are disclosed to any other recipients, including any other blind copy recipients. This parameter can be specified multiple times to specify multiple blind copy recipients. Each instance of the parameter specifies exactly one address. This parameter is optional.
BLOB_COUNT
The number of BLOBs to read from the input stream. If the CONTENT parameter is also specified, the BLOBs are appended to the message as attachments. If the CONTENT parameter is not specified, then the BLOBs become the message.
CC
The email addresses of non-primary recipients to which copies of the message are sent. This parameter can be specified multiple times to specify multiple copy recipients. Each instance of the parameter specifies exactly one address. This parameter is optional.
CONTENT
The text that appears in the message body. Each instance of the CONTENT parameter can correspond to an instance of the CONTENT_TYPE parameter, which specifies the MIME content type of the CONTENT parameter. If no CONTENT_TYPE is specified, the CONTENT parameter defaults to plain text unless the BLOB_COUNT parameter is specified. Multiple values can be specified for this parameter.
CONTENT_LINE_BREAK
This parameter is a multi-valued parameter that can specify a string (or strings) to be used as a line break. Wherever the value of this parameter exists in the content of the email it is replaced with a line break.
CONTENT_TYPE
The MIME content type of a corresponding CONTENT parameter. Each instance of the CONTENT_TYPE parameter corresponds to an instance of the CONTENT parameter and specifies the MIME content type of that parameter. If no CONTENT_TYPE parameters are specified, the MIME content types of the CONTENT parameters defaults to plain text. Similarly, if there are fewer CONTENT_TYPE parameters than CONTENT parameters, plain text values are implicitly added to the list of CONTENT_TYPE parameters.
CONTENT_URL
The CONTENT_URL parameter can be multi-valued. Each value specifies a URL that is opened and read. The content read from the URL becomes a body part (main body or attachment) for the message that is sent.
DBUSER
The username to use when connecting to the SMTP mail server. This parameter is optional.
FROM
The email address of the originator of the message. The default for this parameter is to use the value of the com.infoengine.mail.originator property. If the property does not exist, and the FROM parameter is not specified, an exception is thrown. This parameter is optional.
GROUP_OUT
The optional name of an output group. If this parameter is specified, then an output group is returned containing a single element with three attributes named sent, unsent, and invalid:
The sent attribute specifies the addresses to which the message was sent.
The unsent attribute specifies the addresses that are assumed to be valid but to which the message could not be sent (for example, because the mail server was unavailable).
The invalid attribute specifies the addresses that were invalid.
HEADER
An optional header to add to the outgoing message. Multiple values can be specified for this parameter.
The format of the parameter is name=value (no quotation marks should be placed around value).
For example, the following value adds a CC header to the message even though the user is not actually included in the CC list, and does not receive the email:
cc=user@host.com
* 
This parameter proves useful when sending an email to recipients in multiple languages. When recipient groups have different language locales set, Windchill sends a separate email for each locale. However, sending a separate email per language means that the recipient list only displays users who share the same locale. To prevent confusion as to whether disparate locale groups have been included in an email, you can set HEADER to cc=user@host.com.
HEADERS_CHARSET
The name of the character set that is used in email headers, such as the subject header.
MAIL_SERVER
The internet domain name of the SMTP mail server to which the message is sent for routing to the recipients. The default for this parameter is to obtain the mail server name from the com.infoengine.mail.smtp.server property. If the property does not exist, and MAIL_SERVER is not specified, the mail server defaults to localhost. This parameter is optional.
MAX_DELIVERY_TIME
The maximum length of time in seconds to take in attempting to deliver messages to valid addresses. This is for situations in which the mail transport indicates that the addresses are valid, but the mail server does not accept them (for example, because the mail server is temporarily unavailable or congested). The default value is 60 seconds.
MULTIPART_TYPE
The MIME subtype of the multipart message when multiple CONTENT and/or CONTENT_URL parameter values are specified. The default value for this parameter is mixed.
PASSWD
The password associated with the DBUSER parameter. This parameter is optional.
PASSWORD
The password to specify when authenticating to the SMTP mail server. While PASSWORD can be used in conjunction with USERNAME, it is not necessary for both parameters to be specified. The default for this parameter is to obtain the password from the .mail.smtp.password property. This parameter is optional.
REPLY_TO
The email address or addresses to which replies should be sent. Multiple values can be specified for this parameter. For each instance of the parameter, specify exactly one email address. The default for this parameter is for replies to be sent to the address specified by FROM. This parameter is optional.
SUBJECT
The subject header of the message. If it is not specified, the message does not contain a subject header. This parameter is optional.
TO
The email address or addresses of the primary recipients of the message. It can be specified multiple times to specify multiple primary recipients. Each instance of the parameter specifies exactly one address. This is a required parameter
USERNAME
The username to specify when authenticating to the SMTP mail server. While USERNAME can be used in conjunction with PASSWORD, it is not necessary for both parameters to be specified. The default for this parameter is for the username to be obtained from the .mail.smtp.username property. If the property does not exist, and USERNAME is not specified, an anonymous binding to the mail server is attempted. This parameter is optional.
EXAMPLE
The following example sends an email based on user input: .
<%@page language="java" session="false"%>
<%@taglib uri="http://www.ptc.com/infoengine/taglib/core"
                                               prefix="ie"%>

<ie:webject name="Send-Mail" type="MSG">
  <ie:param name="USERNAME" data="$(@FORM[]user[])"/>
  <ie:param name="PASSWORD" data="$(@FORM[]password[])"/>
  <ie:param name="TO" data="$(@FORM[]to[])"/>
  <ie:param name="FROM" data="$(@FORM[]from[])"/>
  <ie:param name="SUBJECT" data="$(@FORM[]subject[])"/>
  <ie:param name="CONTENT_TYPE"
                            data="$(@FORM[]contentType[])"/>
  <ie:param name="CONTENT" data="$(@FORM[]content[])"/>
</ie:webject>
To actually run this example you would need to provide a form where the user, password, to, from, subject, contentType, and content variables are identified.