Reputation: 8582
I am currently using symfony mailer + sendgrid to send mails. The configuration is rather standard (as described here: https://symfony.com/doc/current/mailer.html).
I am now trying to integrate sendgrid ip pools (so we can use different dedicated ips for different type of mail or customer, allowing them to better flag important mails and us to have better reporting). The pools are generallydescribed here: https://sendgrid.com/blog/ip-pools-all-you-need-to-know/.
The problem is that the sendgrid bridge doesn't seem to support this feature (or maybe I'm missing it?). Also it seems (not sure) that the sendgrid implementation uses the sendgrid smtp api, not the sendgrid webapi and I have no option to add any kind of new/custom header in which to specify the pool.
So how can I use sendgrid ip pools in symfony? Is there any option I can use in mailer to do that or do I need to make something custom (I have no problem with that, but I kind of like symfony mailer abstractization and would've enjoyed keeping it)?
Upvotes: 1
Views: 733
Reputation: 35149
The DSN scheme can be @sendgrid+api
to use the SendgridApiTransport, which will do a POST to the /v3/mail/send
endpoint.
The ip_pool_name
would be set along with the rest of the JSON payload that is posted, along with the rest of the data such as 'personalizations.to.email' & 'name', 'from', 'subject', and all the rest - including the main content.
However, the SendgridApiTransport
does not appear (from my reading of the code), appear to support all the other potential items in the /v3/mail/send
API payload.
It may be possible to create your own transport, based on the existing one to add the extra fields into the payload, and replacing it with the framework.mailer.transports configuration.
Bring this up as a general Mailer issue in the main symfony/symfony issue tracker would also be quite valuable to the wider community as well.
https://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/index.html#-Request-Body-Parameters
Upvotes: 1