Skip to content

substitutionData per recipient #57

Closed
@woodscreative

Description

@woodscreative

Hi, it appears per recipient substitution data key is inconsistent consider the following:

$recipients = [
    [
        'name' => 'Foo',
        'email' => 'foo@example.com'
    ],
    [
        'name' => 'Bar',
        'email' => 'bar@example.com'
    ],
];
$mail[ 'substitutionData' ] = [
    'Company' => 'My Company Name - Works'
];
$mail 'subject' ] = 'Welcome to a Spark Post API Test';
$mail[ 'text' ] = 'Hi {{Name or 'Customer'}}, sent from {{Company}}';
$mail[ 'recipients' ] = [];
foreach ( $recipients as $recipient ) {
    $mail[ 'recipients' ][] = [
        'address' => [
          'name'    => $recipient[ 'name' ],
          'email'   => $recipient[ 'email' ]
        ],
        'substitutionData' => [
            'Name' => $recipient[ 'name' ] . ' - Nope'
        ],
        'substitution_data' => [
            'Name' => $recipient[ 'name' ] . '- Works'
        ]   
    ];
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions