I trying to set up a list of unique arguments per each email, the official reference of the SMTP api describes this feature quite briefly, here.
And the API docs of the SendGrid PHP library the I am using, also didn't help much:
/**
* setUniqueArguments
* Set a list of unique arguments, to be used for tracking purposes
* @param array $key_value_pairs - list of unique arguments
*/
public function setUniqueArguments(array $key_value_pairs)
{
$this->header_list['unique_args'] = $key_value_pairs;
return $this;
}
/**
* addUniqueArgument
* Set a key/value pair of unique arguments, to be used for tracking purposes
* @param string $key - key
* @param string $value - value
*/
public function addUniqueArgument($key, $value)
{
$this->header_list['unique_args'][$key] = $value;
return $this;
}
So in fact, I based my implementation on the obvious logical conclusion, and decided to create multi-dimensional json for the unique-arguments part of the header, with one to one correspondence to the substitution values array, and to the recipients array, but unfortunately, that didn't work, and resulted in an invalid XSMTP API header error being bounced back to my email.
If anyone have used this feature before, and can instruct me briefly on how to use it correctly (perhaps calling addUniqueArgument after each addTo?), it can be a great help for me.