-
Notifications
You must be signed in to change notification settings - Fork 623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mail CustomArg is created on personalization instead of on the Mail itself. #1019
Comments
Hello @patrickkusebauch, I think you may be able to achieve your use case by either passing in the Thank you! With best regards, Elmer |
Sure thing. This does not work: $api = new SendGrid('qwerty123456');
$email = new Mail();
$email->setFrom('[email protected]');
$email->addContent(new Content("text/plain", 'bla'));
$email->addContent(new Content("text/html", 'bla'));
$email->addCustomArg('domain', 'localhost.net');
for ($i = 1; $i<10; $i++) {
$personalization = new Personalization();
$personalization->addTo(new To('test' . $i . '@localhost.net'));
$personalization->addCustomArg(new CustomArg('email_id', $i));
$email->addPersonalization($personalization);
}
$api->send($email); Notice the $api = new SendGrid('qwerty123456');
$email = new Mail();
$email->setFrom('[email protected]');
$email->addContent(new Content("text/plain", 'bla'));
$email->addContent(new Content("text/html", 'bla'));
for ($i = 1; $i<10; $i++) {
$personalization = new Personalization();
$personalization->addTo(new To('test' . $i . '@localhost.net'));
$personalization->addCustomArg(new CustomArg('email_id', $i));
$personalization->addCustomArg(new CustomArg('domain', 'localhost.net'));
$email->addPersonalization($personalization);
}
$api->send($email); But then you have the |
Ah, that makes sense. Thank you for taking the time to clarify for me. This issue has been added to our internal backlog to be prioritized. Pull requests and +1s on the issue summary will help it move up the backlog. |
Issue Summary
From SendGrid API documentation you can attach
customArg
on themail
object itself. However, this library will create a newpersonalization
. This breaks any app that relies onpersonalization
to send different variations of e-mails. It will either:customArg
to the otherpersonalizations
- based on the API,customArg
added on themail
object should be applied to ALL persionalization, unless overwritten in the personalization itself. Currently, thecustomArg
is not applied to any.Steps to Reproduce
to
Mail::addCustomArg
)to
fieldExpected behavior
E-mail can be successfully sent via API (status code 200/202 - whether sending for real or only for validation).
Current behavior
E-mail cannot be sent via API (status code 400). Body:
Technical details:
The text was updated successfully, but these errors were encountered: