What is the best approach for SendGrid development QA environments? We'd like non Production environments that we can store and test our email templates via the API. The SendGrid sandbox setting doesn't allow emails to actually be sent.
Unless there is a better approach, we plan on creating new SendGrid basic accounts for $9.95 a month which allows up-to 40K emails. with this approach, our Dev and QA environments will have different accounts that we can test and deploy with.
I know this is an old question, but I would like to leave our solution here just in case someone else need it.
Sendgrid doesn't allow to have more than one environment, but you can test different content using their dynamic templates.
On your template you can set some conditionals if/else
like this:
{{#if isDev}}
<p>This is development</p>
{{else}}
<p>This is prod</p>
{{/if}}
And then, when you call the API for sending an mail you should pass the var like this (note: this is a Node example):
sendgrid.send({
from: EMAIL_FROM,
templateId: TEMPLATE_ID,
personalizations: [{
dynamic_template_data: {
isDev:(process.env.ENV === 'development'),
},
}],
});
Obviously this is not the same has having different environment, as you we are not testing the final email you will be sending on PRO, cause your metrics will be mixed and, if you test too much, it can impact your sending quota. But it will work if you just test minor changes to time to time like we do.
SendGrid does not have a UAT (User Acceptance Testing) type environment, so seperate users is their suggested solution.
My company took the approach to have different SendGrid users per environment. It allows API access and a separation of accounts, so a production account is not used in other environments. It could be tested using a free account for local or development work, and paid accounts for Staging, QA, or Beta type environments. SendGrid pricing has API access at all levels. Sometimes the trickiest thing with SendGrid testing is your limit on Subusers, which is limited at the lower pricing tiers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With