Adding X-Group to the header

Jesse James

Member
Hey guys,

Hope you're doing very well,
can you guys please help me to add a costume x-header,
I would like to add X-Group: [Group_Name] to the email header, so I can separate,
SMTPs for each group from PMTA.

Thank you very much for you help
 
You could edit apps/console/components/behaviors/CampaignSenderBehavior.php and look for
PHP:
$emailParams['headers'] = array(
                    'X-Mw-Campaign-Uid'     => $campaign->campaign_uid,
                    'X-Mw-Subscriber-Uid'   => $subscriber->subscriber_uid, 
                    'X-Mw-Customer-Uid'     => $customer->customer_uid,
                    'X-Mw-Customer-Gid'     => (int)$customer->group_id,
                    'List-Unsubscribe'           => $listUnsubscribeHeaderValue,
                    'List-Id'                              => $list->list_uid,
);

and make it:

PHP:
$emailParams['headers'] = array(
                    'X-Mw-Campaign-Uid'     => $campaign->campaign_uid,
                    'X-Mw-Subscriber-Uid'   => $subscriber->subscriber_uid, 
                    'X-Mw-Customer-Uid'     => $customer->customer_uid,
                    'X-Mw-Customer-Gid'     => (int)$customer->group_id, // THIS
                    'List-Unsubscribe'           => $listUnsubscribeHeaderValue,
                    'List-Id'                              => $list->list_uid,
);

Basically, adding the group ID to headers list with :
PHP:
'X-Mw-Customer-Gid'     => (int)$customer->group_id,
It's better to have the group ID and not a group name because it avoids confusions.

Thanks.
 
Is there another place to edit to add a custom email header?
I edited apps/console/components/behaviors/CampaignSenderBehavior.php and I have this:

PHP:
                $emailParams['headers'] = array(
                    $headerPrefix . 'Campaign-Uid'     => $campaign->campaign_uid,
                    $headerPrefix . 'Subscriber-Uid'   => $subscriber->subscriber_uid,
                    $headerPrefix . 'Customer-Uid'     => $customer->customer_uid,
                    $headerPrefix . 'Customer-Gid'     => (string)intval($customer->group_id), // because of sendgrid
                    $headerPrefix . 'Delivery-Sid'     => (string)intval($server->server_id), // because of sendgrid
                    $headerPrefix . 'Tracking-Did'     => (string)intval($server->tracking_domain_id), // because of sendgrid
                    'List-Unsubscribe'      => $listUnsubscribeHeaderValue,
                    'List-Id'               => $list->list_uid . ' <' . $list->display_name . '>',
                    'X-MailingID'           => $campaign->campaign_uid . '::'. $list->list_uid, //for Return Path
                    'X-Report-Abuse'        => 'Please report abuse for this campaign here: ' . $reportAbuseUrl,
                );

But the X-MailingID header does not show up in my campaigns

Thanks
 
It does not work, unfortunately.

1) When I hit Save on that server setting page, "::[LIST_UID]" is stripped off. Tried multiple times, but looks like "::" and anything after is removed at save time

2) The header added to my mailing was:
X-MailingID: [CAMPAIGN_UID]

So the tags are not parsed in the "Custom headers" field.

If you remember where in the code are the headers assembled, I am happy to take a look and add what I need in there.

Thanks
 
@Alain Jacquot - before digging any further in this, remove the header from here and then please add it in your delivery server area.
Screenshot 2016-11-18 09.43.09.png
(press the info icon for other tags)
 
Back
Top