-
Notifications
You must be signed in to change notification settings - Fork 780
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
How to enable sandbox #612
Comments
Hi @CrazyGentleman, My apologies, it seems that we have left out that use case here. It should be within I've added this to our backlog. For this issue to gain priority in our backlog, we need additional +1's or a PR. When we receive a PR, that provides the biggest jump in priority. Thanks! With Best Regards, Elmer |
How is the plan to add "sandbox" mode to "@sendgrid/mail" going? Is there an alternative to use sandbox meanwhile? Thanks! |
As mentioned above, it is possible to send in sandbox mode, but it's not explicitly shown in the use cases. One of the fields within the body of what you're sending is
|
Does the email show up in the dashboard when sandbox mode is enabled? |
I don't think so. |
#850 to add this documentation |
For V3 here's the snippet const sgMail = require('@sendgrid/mail'); sgMail.setApiKey(process.env.SENDGRID_API_KEY); const msg = { to: 'recipient@example.org', from: 'sender@example.org', subject: 'Hello world', text: 'Hello plain world!', html: 'Hello HTML world!', templateId: 'd-f43daeeaef504760851f727007e0b5d0', dynamic_template_data: { subject: 'Testing Templates', name: 'Some One', city: 'Denver', }, mail_settings: { sandbox_mode: { enable: true } }, }; sgMail.send(msg); |
Is this not possible? My current sendgrid file looks like this import sgMail from '@sendgrid/mail';
const sendGridApiKey = process.env.SENDGRID_API_KEY;
if (!sendGridApiKey) {
throw new Error('The sendgrid api key has not been set in the environment variables');
}
sgMail.setApiKey(sendGridApiKey);
// I need to be able to do something like this
sgMail.enableSandbox(process.env.NODE_ENV !== 'production')
export { sgMail }; It would be great if eventually sendgrid allowed you to generate sandbox api keys much like stripe test keys |
PR merged to add this to the docs. @malimccalla That's not currently supported. Since it's not quite the same as the original request, could you open a new issue to track this? |
@childish-sambino Done! #1128 |
Issue Summary
How to enable "sandbox" mode, using only "@sendgrid/mail"
Technical details:
The text was updated successfully, but these errors were encountered: