Alternate between email transporters
I want to utilize Gadget and Sendgrid as my email transporter.
For certain internal actions I want to use Gadget and for my more customer facing emails I want to user Sendgrid. Also want to utilize Gadget email as a failsafe if sendgrid has issues. I know how to set sendgrid as my transporter, but what do I pass to revert to Gadget?
Gadget AI recommended this and it doesn't seem to work.
```await (emails as any).setTransport(undefined);
4 Replies
I would recommend that you use
emails
from context when trying to send things internally and use the Sendgrid API when trying to use Sendgrid.Ah, so you mean not to follow the Gadget documentation and set the email transporter to be Sendgrid? Use the actual API calls like I would from a custom API for sending a Sendgrid email?
The docs just tell you how to set up a custom transporter. We're using Node Mailer under the hood and that won't give you the analytics that Sendgrid would. You should just use their package when sending emails to customers.
Do you like this answer?