Tutorial: Advanced E-Mail Settings

The advanced e-mail settings can be found  on the ‘Advanced’ part of the form editor, under ‘Custom E-Mail Notifications’.  First, you have to check ‘Use custom e-mail notifications’.  This will override any of the e-mail settings in the form editor and the plugin’s main settings page.

The ‘Custom E-Mail Notifications’ box allows you to specify multiple notifications, each with different recipients, headers, and content, some or all of which may be populated by data entered into the form.  Here is the basic format:


@start
To: (recipient)
Subject: (the subject)
(additional headers)

@message start
(message content)
@message end
@end

The specification starts with @start, which must be on its own line.  Next is a list of headers.  The list must contain at least a To and a Subject header.  After the headers must be @message start, on its own line, followed by the body of the e-mail to be sent, followed by @message end on its own line.  The specification is closed with @end, which must be on its own line.

Headers

If you are going to include HTML in the body of your email, you should add the following headers:

MIME-Version: 1.0
Content-type: text/html; charset=utf-8

You might also want to add a ‘From’ header. This header must be an e-mail address. If you want to change the name of the sender, use the following format:

From: Joe Schmoe <joeschmoe@email.com>

You should know that the headers used here are not a feature of Form Manager, but of e-mails in general. The header information is passed on to the e-mail program on your server. For more information about e-mail headers look up the Wikipedia article about e-mail headers.

Shortcodes

The next thing you may want to do is insert some of your form’s data.  To do this, there are a number of shortcodes available that you can insert anywhere in the message or headers. 

Information about the admin:
[admin email] – the site admin’s e-mail address

Information about the form user:
[user] - the currently logged in user’s username, if applicable
[user email] - the currently logged in user’s e-mail address, if applicable
[user fullname] - the currently logged in user’s full name, if applicable
[user ip] – the IP address of the form user, whether logged in or not

Submission data:
[data list] – the submission data as an unordered list
[data table] - the submission data as an HTML table
[item (nickname)] - gets an item’s data via its nickname
[label (nickname)] - gets an item’s label via its nickname
[template email] - displays the submitted data using the form’s e-mail template
[template summary] – displays the submitted data using the form’s summary template
[timestamp] - the timestamp associated with the submitted data
[timestamp (format)] – a formatted timestamp.  Replace (format) with a php date format.
[item post_url] – the URL of a published post. Only applies if you are publishing your submissions as posts.
[item parent_url] – the URL of the post ID where the form was submitted from.

Information about the form:
[form title] - the title of the form

Below is a complete example of a specification using some shortcodes:


@start
To: [admin email]
From: Me <me@me.com>
Subject: [item subject]

MIME-Version: 1.0
Content-type: text/html

@message start
<html>
<body>
[template summary]
</body>
</html>
@message end
@end