Well it drove me mad, but finally found how to comment this setting out and stop the system from sending at contacts preferred timezone (if set).
In order to remove the sending of an email to a contact at his preferred timezone, need to do the following:
- Make a copy of the file before doing anything
- Edit file /var/www/mautic/app/bundles/CampaignBundle/Executioner/Scheduler/Mode/Interval.php
- Comment out lines 245 through to 262
Here is the code block:
// Set execution to UTC
if ($timezone = $contact->getTimezone()) {
try {
// Set the group's timezone to the contact's
/** Commented out in order to remove sending at contacts preferred timezone
$contactTimezone = new \DateTimeZone($timezone);
$this->logger->debug(
'CAMPAIGN: ('.$eventId.') Setting '.$timezone.' for contact '.$contact->getId()
);
// Get now in the contacts timezone then add the number of days from now and the original execution date
$groupExecutionDate = clone $compareFromDateTime;
$groupExecutionDate->setTimezone($contactTimezone);
$groupExecutionDate->add($diff);
$groupExecutionDate->setTime($groupHour->format('H'), $groupHour->format('i'));
return $groupExecutionDate;
**/
} catch (\Exception $exception) {
// Timezone is not recognized so use the default
$this->logger->debug(
'CAMPAIGN: ('.$eventId.') '.$timezone.' for contact '.$contact->getId().' is not recognized'
);
}
}