DashaMail component gives your user subscription to the service, including Formit hook and Minishop2 order subscription in case you use it.
Install the extra via MODX package manager
Signup for an account on DashaMail and create an API key, here are more details.
Before using the hook, dashamail_api_key
API key and dashamail_list_id
list ID system settings must be specified. dashamail_merge_fields
list is responsible for default field matching.
[[!FormIt?
&hooks=`dmSubscribe`
&dmEmailField=`email-field-name`
&dmlistId=`12345678`
&dmMergeParams=`merge_1==name,merge_2==phone`
]]
Parameter | Description | Default |
---|---|---|
dmEmailField | The name of the email field in the form. | email |
dmlistId | [optional] DashaMail list id to subscribe to | default value stored in system setting dashamail_list_id |
dmMergeParams | [optional] The merge tags of Mailchimp combined with the form fields. More details can be found in API documentation. | Empty by default, but may be set in dashamail_merge_fields setting. |
Package includes default dmCheckbox
snippet, it is responsible for user's consent subscription checkbox. Place it inside Minishop2 order form. Checkbox can be customized, see tpl
default parameter or specify it directly.
[[!dmCheckbox?
&tpl=`dmCheckboxTpl`
]]
If you need to subscribe user to DashaMail service somewhere else in the code, you can do it like this:
$dashamail = $modx->getService('dashamail','DashaMail',$modx->getOption('dashamail.core_path',null,$modx->getOption('core_path').'components/dashamail/').'model/dashamail/',[]);
if ($dashamail instanceof DashaMail) {
$dm = new DashaMail($modx);
$dm->addListMember('',$email);
}
In next version it is planned to add website users export to DashaMail side along as hooks for Login extra.