1. Subscribing to a newsletter

In the opt-out example, you learned how to let contacts unsubscribe from our different newsletters or promotional emails . It would also be nice if anonymous contacts could subscribe to our newsletters. You will ask for a first name, last name, email address and gender for the salutation. We must validate the contact's input and check whether they are already stored in the Audience List. If they are in the list, they will receive an 'Already subscribed' email.

Preparation: The opt-in fields

If you already followed the optout example, the fields below are already created in your Audience List. The Audience List should have 2 optin fields determining the optin and optout for each email type:

  • OPTIN_NEWSLETTER
  • OPTIN_PROMOTIONS

If one of the fields holds a value '1', the contact is subscribed for that specific email type. you can create Dynamic segments on the Audience List for each email type and use these segments to determine the audience in the newsletter journeys. A journey with a yearly promotional email would use the "Yearly promo" segment for example.

Apart from these fields, and the default MAIL field, this example assumes you have the FIRSTNAME, LASTNAME and GENDER fields in your Audience List. GENDER has an option list determining the field's values ('M' for male, 'F' for female).

If you don't have these fields in your Audience List, create them now.

See also: