<email>

An XMod "processing instruction" that tells XMod to send the data collected by the form to the email addresses listed in the "target" attribute. You have control over what data is sent and how it is formatted by creating a template in much the same way you create a normal XMod display template.  

 

New to version 3.0: Multiple <email> tags are allowed in the form. Each email tag can optionally include a <content> child tag which contains the contents of the email you wish to send. These contents can be HTML tags and can include contents from the form by using <xmod:field> and other <xmod:...> tags. When using HTML and <xmod:...> tags, you must enclose the everything in <literal> tags (see the examples for more information).

 

ATTRIBUTES:

target

Comma-separated list of email addresses. XMod will send the data collected by the form to each of these addresses. You may also specify the name of a field within the form that will contain an email address. To do so, enclose the field's name (the "ref" attribute) in braces like so: {fieldname}. This could be a text box or a list control. If the text box contains a comma-separated list of email addresses, they will be added to any addresses explicitly listed. For a list control to supply addresses, the control's items must have their value set to email addresses. If a list control allows multiple selections, the selected addresses will be added to any addresses explicitly listed in the target attribute. (Required)

from

A single email address from which the email should be sent. Like target this attribute can contain a field name (enclosed in braces {fieldname}) to instruct XMod to use the value of form field. Note, as this attribute only accepts a single address, the form field should only contain one email address. (Required)

subject

The subject line of the email to be sent. If not specified then the email will have a blank subject line.

smtpserver

The name of the SMTP server to use to send the email (optional)

smtpusername

The user name for the account used to send email from the SMTP server (optional)

smtppassword

The password used for the account used to send email from the SMTP server (optional)

attachment

This optional attribute allows you to specify a filename and path to a file and have that file attached to the outgoing email. New to Version 3.0

sendrule

This optional attribute enables you to tell XMod when the email should be sent - when a record is created, when it is updated, or both. Specify the rules as a comma-delimited list. Valid values are:

 

  • add - Email will be sent when a new record is added to the database

  • update - Email will be sent when a record has been updated.

  • approve - Email will be sent when a record has been approved
    New to Version 4.7

     

To maintain a consistent behavior with previous versions of XMod, If you don't specify this attribute, XMod will assume the email should be sent when a record is added and when it is updated.

 

New to Version 3.2

 

CHILD TAGS

content

This child tag is optional. When used it contains the Body of the email that will be sent. This tag can contain HTML tags and XMod display tags (<xmod:field>, etc.). Important: In order to use HTML and XMod tags, you must enclose them in <literal> tags. See the examples for more information.

Content has a single attribute: format  If this attribute is html then the email will be sent in HTML format. Other wise, the email will be sent as plain text.

EXAMPLE

In this example, we've specified a couple of email addresses and the value of the field with the name EmailAddress (note the field name is enclosed in braces). We've also added the optional SMTP-related attributes.

 

<email target="[email protected],[email protected],{EmailAddress}" from="[email protected]" subject="Data From Another Form Submission" smtpserver="mail.mysite.com" smtpusername="XmodLover" smtppassword="Xmod4Ever" />

 

 

The following 2 examples make use of XMod's ability to specify content for the email. Both examples can be included in the same form to send one set of information to the customer and another to your sales department. In the first, we're sending the email to the address entered by the user in the CustomerEmail field. We also provide a friendly product name, provided by the display text of the ProductSelection listbox.

 

In the second email, we're sending the email directly to our sales department and using the value of the selected product, which the product ID.

 

Finally, note the use of the <literal> tag in both examples. This is required whenever you use HTML tags and <xmod:...> tags.

 

<email target="{CustomerEmail}" from="[email protected]" subject="Your Order Receipt">

  <content format="html">

    <literal>

      <h2>Order Details:</h2>

      <p>Customer Name: <xmod:field name="FirstName"/> <xmod:field name="LastName"/><br />

      Item(s) Ordered: <xmod:field name="ProductSelection"/></p>

    </literal>

   </content>

</email>

<email target="[email protected]" from="[email protected]" subject="Order Placed">

  <content format="html">

    <literal>

      <h2>Order Details:</h2>

      <p>Customer Name: <xmod:field name="FirstName"/> <xmod:field name="LastName"/><br />

      Item(s) Ordered: <xmod:field name="ProductSelection" usevalue="true"/></p>

    </literal>

   </content>

</email>

 

 

The sample below demonstrates use of the "sendrule" attribute to only send the email if the record is being added to the database.

 

<email target="[email protected]" from="[email protected]" subject="Your Submission" sendrule="add">

  <content format="html">

    <literal>

      <h2>Order Details:</h2>

      <p>Customer Name: <xmod:field name="FirstName"/> <xmod:field name="LastName"/><br />

      Item(s) Ordered: <xmod:field name="ProductSelection"/></p>

    </literal>

   </content>

</email>

 

The sample below demonstrates use of the "sendrule" attribute to only send the email if the record is being updated.

 

<email target="[email protected]" from="[email protected]" subject="Your Submission" sendrule="update">

  <content format="html">

    <literal>

      <h2>Order Details:</h2>

      <p>Customer Name: <xmod:field name="FirstName"/> <xmod:field name="LastName"/><br />

      Item(s) Ordered: <xmod:field name="ProductSelection"/></p>

    </literal>

   </content>

</email>

 

The sample below demonstrates use of the "sendrule" attribute to specify multiple rules - in this case, the email will be sent when a record is being added and also when it is being updated.

 

<email target="[email protected]" from="[email protected]" subject="Your Submission" sendrule="add,update">

  <content format="html">

    <literal>

      <h2>Order Details:</h2>

      <p>Customer Name: <xmod:field name="FirstName"/> <xmod:field name="LastName"/><br />

      Item(s) Ordered: <xmod:field name="ProductSelection"/></p>

    </literal>

   </content>

</email>