Skip to content

Parcel Type: User Email

objectivehtml edited this page Dec 10, 2014 · 5 revisions

Overview

The User Email parcel type can send emails when users are saved, logged in, logged out, activated, deleted, before password is set, after password is set, suspended, unsuspended, unlocked, and/or verified. You can also specify HTML and plain text templates, along with sending the email with any service.

  1. Events
  2. Settings
  3. Variables

Events

The following events are used in this parcel type:

  • users.onSaveUser
  • users.onLogin
  • users.onLogout
  • users.onActivateUser
  • users.onDeleteUser
  • users.onBeforeSetPassword
  • users.onSetPassword
  • users.onSuspendUser
  • users.onUnlockUser
  • users.onUnsuspendUser
  • users.onVerifyUser

Settings

To Name

The name of the recipient.

To Email

The email address of the recipient.

From Name

The name of the sender.

From Email

The email of the sender.

Reply To

The reply to email address. (Optional)

Cc

The Cc email address or addresses. (Optional)

Bcc

The Bcc email address or addresses. (Optional)

Subject

The email subject.

HTML Template

The HTML template path.

Plain Text Template

The plain text template path.

Extra Conditionals

What extra conditionals should be used to validate this parcel? Return false is you want to prevent the email from sending.


Variables

All the fields in the parcel can be static or dynamic. Each field is parsed with Twig. The tags that are available is obviously determined by your UserModel and how you have your sections setup. Each ParcelType setting is parsed with the entry variable. Then once the ParcelType settings are parsed, the Service settings are parsed with entry and settings variables. The settings variable is the ParcelType settings that were just parsed. The Service is whatever service you chose to send the parcel. So to be clear, all settings will be parsed and can contain dynamic fields.

If you have parsing errors, these will appear when your parcel first fires. Don't be alarmed, just fix the errors and the email should send.

Example for Parcel Settings

{{ isNewUser }}
{{ user.firstName }}
{{ user.LastName }}
{{ user.yourUserField }}

Example for Service Settings

{{ isNewUser }}
{{ user.firstName }}
{{ user.LastName }}
{{ user.yourUserField }}
{{ settings.toName }}
{{ settings.toEmail }}
{{ settings.fromName }}
{{ settings.fromEmail }}
{{ settings.replyTo }}
{{ settings.cc }}
{{ settings.bcc }}
{{ settings.subject }}
{{ settings.body }}
{{ settings.htmlBody }}

Note, these are just a sample of the variables that are available. Any parameter passed to an event will always be available for parsing (with the same variable) as the parameter itself. In addition to variables, these fields are parsed just like regular templates. Any and all Twig logic may be used to parse your fields.