Skip to content

<Email>

After a form submits successfully, the <Email> tag sends an email. The body of the email is the content between the opening and closing <Email> tags — plain text or HTML, with field tokens substituted at send time. A form may contain any number of <Email> tags; each can target different recipients with different bodies.

Action timing

The <Email> tag only runs when the form submits successfully. Tokens in the attributes and body are evaluated at that point — not when the form loads — so [[FieldName]] tokens read user input.

Not for bulk mail

The <Email> tag is for transactional emails — confirmations, notifications, and similar one-shot messages. It is not a bulk mailer.

Example

html
<AddForm>
  <SubmitCommand CommandText="INSERT INTO Users(FirstName, LastName) VALUES(@FirstName, @LastName)" />
  <table>
    <tr>
      <td><Label For="txtFirstName" Text="First Name" /></td>
      <td><TextBox Id="txtFirstName" DataField="FirstName" DataType="String" /></td>
    </tr>
    <tr>
      <td><Label For="txtLastName" Text="Last Name" /></td>
      <td><TextBox Id="txtLastName" DataField="LastName" DataType="String" /></td>
    </tr>
    <tr>
      <td colspan="2"><AddButton Text="Add" /> <CancelButton Text="Cancel" /></td>
    </tr>
  </table>
  <Email To="[email protected]" From="[email protected]"
         Subject="A New Record Has Been Added ([[FirstName]] [[LastName]])" Format="Html">
    The following record was added to the database:<br />
    <strong>First Name:</strong> [[FirstName]]<br />
    <strong>Last Name:</strong> [[LastName]]
  </Email>
</AddForm>

Properties

PropertyValuesDefaultDescription
To *email | comma-listPrimary recipient(s)
From *emailSender's email address
SubjectstringEmail subject line. Field tokens may be used
CCemail | comma-listCarbon-copy recipients
BCCemail | comma-listBlind-carbon-copy recipients
ReplyToemailAddress used when the recipient clicks "Reply"
FormatText HtmlTextPlain-text or HTML email
Attachmentpath | pipe-listOne or more files to attach
SendIfexpressionWhen set and the expression is false, the email is not sent
EnableSslTrue FalseFalseWhen True, the SMTP connection uses SSL
SmtpServerstring(DNN setting)Override the SMTP server for this email
SmtpUsernamestring(DNN setting)Override the SMTP username
SmtpPasswordstring(DNN setting)Override the SMTP password

* Required property

Body content

The text between the opening and closing <Email> tags is the body of the email. When Format="Html", you can use HTML markup. Field tokens such as [[FirstName]] are substituted at send time.

html
<Email To="[email protected]" From="[email protected]" Subject="New entry" Format="Html">
  <p>A new entry was created by [[User:DisplayName]]:</p>
  <p>[[Notes]]</p>
</Email>

Property Details

  • To: One email address or a comma-delimited list. List controls (e.g. <CheckboxList>) can also feed this property — the control must use the pipe (|) separator for its values.

  • From: The sender's email address. Many SMTP servers reject messages whose From does not match an authorized sender, so this is typically your site's no-reply or system address.

  • CC: Carbon-copy recipients — they receive the email and are visible in the recipient list. Same format as To.

  • BCC: Blind-carbon-copy recipients — they receive the email but are not visible in the recipient list. Same format as To.

  • Attachment: A file system path or a tilde-prefixed virtual path. Pipe-separate multiple paths to attach more than one file.

    FormExample
    Mapped path/files/filename.ext
    Mapped path with drivec:/files/filename.ext
    Virtual (tilde) path~/portals/0/files/filename.ext (since v4.8)
    Multiple files~/portals/0/files/a.ext|~/portals/0/files/b.ext
  • SendIf: A simple equality expression. When set and the result is false, the email is not sent. Useful for sending an email only when the user opted in or selected a particular option. Comparisons are text-only and case-insensitive.

    html
    <Email SendIf="[[Department]] = Sales" To="[email protected]" From="..." Subject="...">
      ...
    </Email>