Skip to content
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

Sending template emails via API #981

Closed
ramosjeremy opened this issue Sep 10, 2019 · 7 comments
Closed

Sending template emails via API #981

ramosjeremy opened this issue Sep 10, 2019 · 7 comments
Labels
type: question question directed at the library

Comments

@ramosjeremy
Copy link

ramosjeremy commented Sep 10, 2019

I am able to send regular emails via the API without trouble. However, I need to send an email with a template. I am able to send a test email from my SendGrid console, but when I try to send via the API the email never arrives at the destination.

The POST returns a 202 Accepted as if everything is ok.

Here is the template.

<html>
<head>
  <title></title>
</head>
<body>
  Hello {{ first_name }}
</body>
</html>

Here is the POST body.

{
   "personalizations":[
      {
         "to":[
            {
               "email":"[email protected]",
               "name":"Jeremy Ramos"
            }
         ],
            "dynamic_template_data":{  
            "first_name":"Test Name"
         },
         "subject":"Test Template Email"
      }
   ],
   "from":{
      "email":"[email protected]",
      "name":"support staff"
   },
   "reply_to":{
      "email":"[email protected]",
      "name":"Jeremy Ramos"
   },
   "template_id": "d-539f599eeef64433968c2d524311cbdb"
}
@perezpaya
Copy link

Having the same issue

@ramosjeremy
Copy link
Author

Having the same issue

Perezpaya - I figured out the issue. I was pointing to the wrong account. Double check your APIKey and make sure the template ID you are using exists in the same account.

@flexchar
Copy link

flexchar commented Nov 4, 2019

Same error. It is very big shame that SendGrid doesn't allocate resources to fixing these issues. Especially from paying clients point of view.

@wispyco
Copy link

wispyco commented Dec 14, 2019

I get a similar issue but I get the following error s is not a function

@Anav0
Copy link

Anav0 commented Jan 21, 2020

Issue is still here. Any ideas?

@flexchar
Copy link

To be perfectly honest, for me it turned out to be an API key issue. The code base I was working with was using other API key that is legit but does not belong to our account, thus it never appeared in the logs.

However, Twilio/SendGrid should definitely improve API responses and tell what exactly is wrong.

@childish-sambino
Copy link
Contributor

@wispyco The error you're seeing was fixed by #1039

@childish-sambino childish-sambino added the type: question question directed at the library label Mar 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question question directed at the library
Projects
None yet
Development

No branches or pull requests

6 participants