# do-send-email-from-template

The <do-send-email-from-template> action causes an email notification to be generated using a SMTP notification configuration object, email template object and replacement tokens. The target SMTP server along with credentials for authentication (except for the password, which when needed is specified by <arg-password>) and the originating address are read from the SMTP notification configuration object. The subject and email message are created using the template object and template replacement tokens. Replacement tokens are declared within a <arg-string> element and tag name attribute. Reserved replacement tokens specify the various recipient addresses.

> Reserved Token | Description
> --- | ---
> to | Adds the address to the list of email recipients. Multiple instances are allowed. May contain a comma separated list of recipients.
> cc | Adds the address to the list of CC email recipients. Multiple instances are allowed. May contain a comma separated list of recipients.
> bcc | Adds the address to the list of BCC email recipients. Multiple instances are allowed. May contain a comma separated list of recipients.
> reply-to | Specifies the address to be used as the email message reply address.
> encoding | Specifies the character encoding to use for the email message.
> custom-smtp-header | Specifies a custom SMTP header to add to the email message.

If any type of error occurs as part of sending the email, the error string will be available to the enclosing policy in the local variable named error.do-send-email-from-template. Otherwise that local variable will be unavailable.

### Example

>     <do-send-email-from-template notification-dn="/cn=security/cn=DefaultNotification Collection" template-dn="/cn=security/cn=DefaultNotification Collection/cn=PS-Sync Fail">
>       <arg-password>
>         <token-named-password name="email-server"/>
>       </arg-password>
>       <arg-string name="manager">
>         <token-text>Bill Jones</token-text>
>       </arg-string>
>       <arg-string name="surname">
>         <token-text>Smith</token-text>
>       </arg-string>
>       <arg-string name="given-name">
>         <token-text>Joe</token-text>
>       </arg-string>
>       <arg-string name="to">
>         <token-text>to_user@company.com</token-text>
>       </arg-string>
>       <arg-string name="cc">
>         <token-text>cc_user@company.com</token-text>
>       </arg-string>
>       <arg-string name="custom-smtp-header">
>         <token-text>X-Priority: 1(Highest)</token-text>
>       </arg-string>
>     </do-send-email-from-template>

## 1. Allowed Content

> arg-password
>   password argument
> arg-string
>   string argument

## 2. Attributes

> Attribute | Value(s) | Default Value
> --- | --- | ---
> disabled | true | false true if this element is disabled | false
> notification-dn | CDATA slash form DN of SMTP notification configuration object supports variable expansion | #REQUIRED
> notrace | true | false true if this element should not be traced during execution of policy | false
> password | CDATA password for user on SMTP server deprecated - use <arg-password> with <token-named-password> instead | #IMPLIED
> template-dn | CDATA slash form DN of email template object supports variable expansion | #REQUIRED

## 3. Content Rule

> ( arg-password ? , arg-string * )

## 4. Parent Elements

> actions
>   actions that are performed by a <rule>
> arg-actions
>   actions argument

Top Elements || All Elements || Tree