contactsTemplate

Type: string
Default: email

By default, our contact picker will populate a target element with the contacts that the user selected in the contact picker. You can specify a target element by decorating it with the class name cloudsponge-contacts. Now, contacts are objects while the value of an HTML element is a string. The contact picker will map the array of contact objects to a string of comma-separated RFC 2822 email addresses. They will look like Firstname Lastname <username@example.com>. These emails can be used to populate any of the recipient fields of an email.

Combine this option with the contactsDelimiter option to fully specify the format of the contacts string.

However, you may not be looking to populate an email directly from the form data. Some of our customers have quite exotic requirements for the data format, so we’ve created a template system to let you pick any one of our default templates, or create your own with a free-form a string. Our standard templates are listed below in short form and long form. You can use the short form to specify any of these templates.

  • name: '${name}'
  • email: '${email}'
  • name+email: '${name} <${email}>'
  • name+phone: '${name}: ${phone}'
  • name+email+phone: '${name} <${email}>: ${phone}'
  • name+email+address: '${name} <${email}>: ${address}'

Alternatively, you can create your own template using substitution variables in a string, for example: "${name} - ${email}". Valid variable names are: name, email, primaryEmail, firstName, lastName, jobTitle, company, companies, groups, dob, birthday, emailsList, phonesList, homeAddress, workAddress, otherAddress, phone, address.

Try CloudSponge for free in your
testing environment

Get Started

Have a questions or prefer a guided tour?
Schedule a consultation with our Founder.