As of USP Pro version 2.8, it’s possible to create custom email alerts per form. So each form can send different email notifications whenever a post is submitted, approved, denied, and/or scheduled. This tutorial explains how it’s done.

How to use

To add a custom email alert to any USP Form, add the following shortcode:

[usp_email_alert]..custom email message..[/usp_email_alert]

Try adding that to a test form and submit a post. You should receive an email letting you know that a post has been submitted. And the message will be whatever you specify between the opening and closing shortcodes. And if you have enabled “HTML Format” in the USP Admin settings, you can include markup in the message, for example:

[usp_email_alert]

<h1>Thank you!</h1>
<p>Thanks for submitting a post at %%blog_name%%</p>
<p>We will let you know shortly if your post is approved :)</p>

[/usp_email_alert]

As you can see, you also can include any Email Shortcodes, such as %%blog_name%%, %%user_name%%, %%user_email%%, or whatever is required. You also can include Custom Fields if desired.

Important! At this time, custom email alerts work only in post-submit forms. So combo forms are not supported at this time.

Note: Make sure Post Formatting is enabled if you want to use HTML with [usp_email_alert].

More infos

Using the [usp_email_alert] shortcode, you can create custom, per-form alerts for any of the following:

Alerts for Users

  • Post-Submission Alerts
  • Post-Approval Alerts
  • Post-Denied Alerts
  • Post-Scheduled Alerts

For example, to create a custom alert that will be sent when the post is approved, you can specify the type attribute as approval, for example: [usp_email_alert type="approval"]. When the type attribute is not specified, the alert will be for post submissions (default).

Alerts for Admin

  • Post-Submission Alerts
  • Post-Approval Alerts
  • Post-Denied Alerts
  • Post-Scheduled Alerts

Note: To create a custom admin alert, specify such in the user attribute like so, [usp_email_alert user="admin"]. When the user attribute is not included in the shortcode, the alert will be for the user (default).

Here are some further notes about custom email alerts:

  • By default, custom alerts use the options specified in the “Email Settings” (USP Admin tab)
  • For example, custom alerts are sent to the email address(es) specified in the “Email Settings”
  • Some of the “Email Settings” can be overridden using shortcode attributes (see below)
  • You can send copies of custom alerts to any email address using the cc attribute

Shortcode Reference

Here is a complete reference of all attributes available to the [usp_email_alert] shortcode.

Shortcode: Custom Email Alerts

Returns hidden input fields with encoded values

Syntax: [usp_email_alert]..email message for user..[/usp_email_alert]

Attributes:
	user    = (optional)  email alert for user or admin [default: user]
	type    = (optional)  type of alert (submit, approval, denied, scheduled) [default: submit]
	subject = (optional)  subject line [default: Email Alert from Site Name]
	cc      = (optional)  additional recipient address for admin alerts only (comma separate multiple values) [default: empty/none]

Pro Tip: You can disable email alerts for any form.

Example

Here is an example showing how to use the above attributes to customize the email alert.

[usp_email_alert user="user" type="submit" subject="Email Alert from Site Name"]

<h1>Thank you!</h1>
<p>Thanks for submitting a post at %%blog_name%%</p>
<p>We will let you know shortly if your post is approved :)</p>

[/usp_email_alert]

Add that code to any USP Form, and the custom message will be sent to the user for each post submission. Customize as needed to dial in the perfect notification for each form.

Note: You can include shortcut variables such as %%blog_url%% and %%blog_name%% in the custom email message. Basic markup also allowed if Post Formatting is enabled.

Related