Extension provides handling mailer objects in CiviCRM for transactional emails (not CiviMail!).
There is only page displaying current settings, on url civicrm/gooseberry/settings.
Assumptions:
- each alternative mailer has own setting
mailing_backend_alternate[1-2],- first at
mailing_backend_alternate1, - second at
mailing_backend_alternate2,
- first at
- in session variable
gooseberryis stored which mailer will be used, - mailer is changed by
hook_civicrm_alterMailer().
The extension rewrites $mailer object in hook_civicrm_alterMailParams(). Remember that CiviMail doesn't use this hook, so it's not possible to change setting for CiviMail by this extension. Instead of this CiviMail uses default setting mailing_backend provided by page Outbound Mail.
This works only when Outbound Mail is set to any STMP server.
This works only for $context = 'singleEmail'.
- set your alternative SMTP at "Outbound Mail" page
- run sql query
INSERT INTO civicrm_setting (name, value, domain_id, contact_id, is_domain, component_id, created_date, created_id)
SELECT 'mailing_backend_alternate1', value, domain_id, contact_id, is_domain, component_id, created_date, created_id
FROM civicrm_setting WHERE name = 'mailing_backend';- set your default SMTP at "Outbound Mail" page
There are two ways for switch on:
- set up params:
$params['gooseberry'] = 1; // during preparing params for method CRM_Utils_Mail::send()- set up
groupNamein settingsreGroupName*as a list of regular expressions. Use sql query to insert or update, for example:
INSERT INTO civicrm_setting (name, value, domain_id, contact_id, is_domain, component_id, created_date, created_id)
SELECT 'reGroupName1', 's:52:"/Scheduled Reminder Sender/||/Activity Email Sender/";', domain_id, contact_id, is_domain, component_id, created_date, created_id
FROM civicrm_setting WHERE name = 'mailing_backend';
UPDATE civicrm_setting
SET value = 's:95:"/Scheduled Reminder Sender/||/Activity Email Sender/||/Report Email Sender/||/Mailing Event .*/";'
WHERE name = 'reGroupName1';
UPDATE civicrm_setting
SET value = 's:0:"";'
WHERE name = 'reGroupName1';Emails from reGroupName1 uses mailing_backend_alternate1 configuration.
- /Scheduled Reminder Sender/ - email via Scheduled Job job.send_reminder
- /Mailing Event .*/ - email "Confirm a pending subscription" on mailing
- /Activity Email Sender/ - email via "Send an Email" form below "Actions" button on contact page
- /Report Email Sender/ - email via tab "Email Delivery" on any report
- /SpeakCivi WeMove/ - confirmation emails in SpeakCivi extension for standard campaigns
- /SpeakCivi YouMove/ - confirmation emails in SpeakCivi extension for YouMove campaigns
- /SEPA Email Sender/ - emails in SEPA extension
- /WemoveConsent.request/ - emails with consent request sent via CommitCivi
Thanks to value of session variable gooseberry extension decides which alternative mailer will be used.
0- use default SMTP server (this depends onmailing_backend),1- use first alternative SMTP server,2- use second alternative SMTP server.