Rotating HTML from content blocks not matching FROM

a2kraken

New Member
Hello,
i have begun experimenting with sending random content blocks, and it is a great tool. However, i typically send the FROM: to match the content i am sending. I noticed i cant have the FROM change from content block to content block, which in turn is causing my subscriber to not recognize my FROM name. I have to use one umbrella FROM name for all my content blocks. Is there a way around this? To reiterate, or reword ...

[RANDOM_CONTENT: BLOCK: ID1 | BLOCK: ID2 | BLOCK: ID3] Would all have matching FROM names, whereas if i created individual campaigns, these would all have different FROM's.

Any advise is greatly appreciated! SMTP over and out.
 
What do you mean? Can you give us an example?
Hi! Thanks for jumping in.


What I’m trying to do
I run a single campaign that uses randomized content blocks (think “Block A / Block B / Block C” with different brand creatives). I’d like the From name to match the brand of the block that rendered for that recipient—e.g.:


  • If the creative that renders is A, the From should be “A”
  • If the creative that renders is B, the From should be “B”

Right now the From name/email is global at the campaign level, so all blocks share one umbrella From, which hurts recognition.


What I need to know


  1. Can the “From name” field accept a tag/custom field that resolves per-recipient at send time?
    • Example: put a tag like [BRAND] into the From name field so it renders as the matching brand for each message.
    • If yes, which tag types are supported there (custom field, list/company field, other)? Any syntax requirements?
  2. Is there a supported hook/extension point to set the From name dynamically at render time?
    • For example, an event/filter where an extension can set the FromName based on a variable in the message (like a block ID or a custom field).
  3. If neither is supported, I’ll assume the only workarounds are:
    • Clone the campaign per brand with the correct From and split traffic, or
    • Use the API to programmatically clone N campaigns (one per brand) before send.

I’m not trying to change delivery server or envelopes—just the From name to match the randomized brand block in a single campaign. If there’s a supported way to bind From name to a per-recipient value (custom field/tag) or to do it via an extension hook, that would solve it perfectly.


Appreciate any guidance on what’s supported today and where I should look (settings, tag parsing for headers, or the right hook).
 
Can the “From name” field accept a tag/custom field that resolves per-recipient at send time?
  • Example: put a tag like [BRAND] into the From name field so it renders as the matching brand for each message.
  • If yes, which tag types are supported there (custom field, list/company field, other)? Any syntax requirements?
You should be able to do this, just use [BRAND] in the From name field,

Is there a supported hook/extension point to set the From name dynamically at render time?
  • For example, an event/filter where an extension can set the FromName based on a variable in the message (like a block ID or a custom field).
You should not need to do this given the above, but yes, there's a hook for this:
PHP:
hooks()->applyFilters('mailer_after_create_message_instance', function($message, $params, $mailer) {
    if ($mailer instanceof MailerSwiftMailer) {
        $message->getFrom()->setName('New name');
    } elseif ($mailer instanceof MailerSymfonyMailer) {
        $fromEmail = $message->getFrom()[0]->getAddress();
        $message->from(new \Symfony\Component\Mime\Address((string)$fromEmail, 'New name'))
    }
    
    return $message;
    
});
(above not tested, should give you an idea though)
 
Back
Top