Mailchimp can be used to store your contacts and engage them by sending targeted emails to help grow your business. At minimum, a contact consists of a person's email address. This plugin can add contacts to your Mailchimp audience using data from your HTML form. Need to offer your users opt-in methods or collect custom data fields? This plugin can do that too!

Plugin configuration

Start by connecting your Mailchimp account by clicking the "Connect Mailchimp Account" button.

Connect Mailchimp Account

This will open a pop-up that will prompt you to sign in with your Mailchimp account and authorize Postform to programmatically access your account.

Mailchimp OAuth2 Pop-up

Once authorized, you will be returned to Postform. Select the audience/list where new contacts should be added when your form is submitted.

Connect Mailchimp Account

Once an audience is selected, you'll be presented with additional configuration options. At minimum, the plugin needs to know which field in your HTML form collects the user's email address. For example, given the following email input:

<input type="email" name="yourEmail" required />

The email field name, yourEmail, can be specified in the plugin:

Configure Email Input Name

Opt-In Field

By default, this plugin will add a new contact for each form submission. However, it's common to give the user the option to subscribe by using a checkbox input field:

<input type="checkbox" name="subscribe" />

If your form contains an opt-in field, you just need to specify the name of the field. Using the checkbox example above, the plugin can be configured to use the subscribe field to opt-in:

Opt-In Input Name

When a submission is receiveid, Postform will only add a new contact to Mailchimp if the opt-in field has a value.

Double Opt-In

By checking the "Double Opt-In" checkbox, the user will be added to Mailchimp with a "pending" status. Mailchimp will send an email to the user to confirm they want to be subscribed. The user's status will change to "subscribed" after the "Yes, subscribe me to this list." button is clicked:

Mailchimp Double Opt-In

For more information, refer to Mailchimp's docs.

Merge Field Mapping

In addition to collecting email addresses, you can collect any data points you want in Mailchimp. This can help you send more personalized and targeted emails. In Mailchimp, fields can be managed from the "Audience fields" settings page:

Mailchimp Audience Fields

Using the following form as an example:

<form action="" method="POST">
    <label for="firstName">First Name</label>
    <input id="firstName" name="firstName" />
    <label for="lastName">Last Name</label>
    <input id="lastName" name="lastName" />
    <label for="email">Email</label>
    <input id="email" name="email" />
    <label for="phoneNumber">Phone Number</label>
    <input id="phoneNumber" name="phoneNumber" />
  <button type="submit">Submit</button>

The plugin can be configured as shown below. Note the input name attribute is used to map the field in your HTML form to Mailchimp's field.

Mailchimp Field Mapping

Was this page helpful?