Is there a way to change the signature dynamically depending on which sending server is used?

jhall95

Member
I have a few gmail servers that send sometimes and each one is linked up to a user, so if my template has a signature it won't align with the sender.

Can twig or some other function in mailwizz help with this?
 

twisted1919

Administrator
Staff member
The easiest way around this is to fetch the signature from a remote url depending on the given delivery server, by using the REMOTE_CONTENT tag and DS_* tags to identify the delivery server. However, this adds network latency, so it might not be desired.
Another way is to add a custom tag and parse it accordingly, something like:
Code:
<?php

Yii::app()->hooks->addFilter('campaigns_get_common_tags_search_replace', function($searchReplace, $campaign, $subscriber, $server) {
    
    if (empty($server)) {
        return $searchReplace;
    }

    $signatureTag = '[DS_CUSTOM_SIGNATURE]';
    $signature = '';

    if ($server->server_id == 1) {
        $signature = 'Signature 1';
    } elseif ($server->server_id == 2) {
        $signature = 'Signature 2';
    }

    $searchReplace[$signatureTag] = $signature;


    return $searchReplace;
});
^ This goes in apps/common/init-custom.php

Then you can simply use [DS_CUSTOM_SIGNATURE] tag in your email campaigns.
 
Top