Do you want to send emails to subscribers who have submitted a form? Learn how to send emails to visitors who have submitted a form directly on your WordPress site.
We use this method on our community site to send the daily and weekly digest emails of new discussions, or an instant email for each discussion since this content is not easily accessible through email marketing sites like MailChimp.
Create a form to collect subscribers
If you don't already have a form that is collecting email addresses or user IDs, create a form now. This could be a contact form, registration form, or any type of form you would like. Include an email address or a user ID field.
On the community site, we use the registration form and include an option to select between daily and weekly emails.
Make a view to list the email addresses
Next, we'll need to compile the email addresses in a comma-separated list. Create a view that uses the subscription form you already built. Set this view to show all entries.
In the content box, include the email address followed by a comma like this:
If you are using the User ID field, your content will look more like this:
Preview your view to make sure you see a list of email addresses on the page.
Build the form to send emails to subscribers
Now you need a form that will trigger the email. This would be a type of newsletter form. You could include a field for the email content and subject line if you plan on sending different emails to this same list of subscribers.
Here's where is all comes together. Go to the settings page for this form, and add an email notification form action. Insert the view shortcode into the recipients box and fill in the email content and subject boxes.
If you don't want the recipients to see the full list of email addresses in the email they receive, either add the view shortcode in the BCC box, or add a bit of custom to send one email per recipient.
One our community site, the form that triggers the instant emails is the form that creates a new discussion. Now when a new discussion is submitted, everyone on this list gets an email notification.
Filter the email subscribers
In cases like our community site, we have multiple options and only want to send an immediate email to a portion of them. In order to send only to those who have selected that they would like immediate notifications, the email list view needs to be filtered.
First, go back to edit the view and add a row to filter by parameter. For example, the filter may be "Subscription is equal to [get param=subtype]".
In your email settings, change your view shortcode in the recipients box to:
[display-frm-data id=x subtype="immediate"]
Change "immediate" to the saved value of the option you are filtering by.
Automatically send weekly emails
If you'd like this email to be triggered multiple times, take a look at the instructions to send all entries in a weekly email.