Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sendgrid returns 202 but doesn't send email

Tags:

sendgrid

I'm trying to get the basic "hello world" of sendgrid working, but have so far been unsuccessful. The response returns code 202, suggesting that it will send the email, but the email never sends out. Does anyone know what's going on?

import sendgrid  sg = sendgrid.SendGridAPIClient(apikey='**my-api-key**') data = {   "personalizations": [     {       "to": [         {           "email": "[email protected]"         }       ],       "subject": "Hello World from the SendGrid Python Library!"     }   ],   "from": {     "email": "[email protected]"   },   "content": [     {       "type": "text/plain",       "value": "Hello, Email!"     }   ] } response = sg.client.mail.send.post(request_body=data) print(response.status_code) 
like image 646
Matrym Avatar asked Feb 13 '17 21:02

Matrym


People also ask

How many emails can you send per day on SendGrid?

Once you create a sender identity a, you can send 100 emails per day. If you need to send more than that, complete your account setup to upgrade to a paid plan! Do I have to sign up for the Marketing Campaigns and Email API separately? Yes!

How many emails can SendGrid send per hour?

A free plan on SendGrid allows you to send up to 100 emails per day; upgrading to a paid plan, you can send up to 1,500 emails per day and no more than 400 emails per hour.

How do I check my SendGrid email status?

You can check email delivery status by using the Email Activity page, or by using the Event Webhook. For a successful delivery, the Email Activity page, or the Event Webhook shows a delivered event - expanding it shows a reason code of 250 OK. This means the receiving server has accepted the message.

How do I stop SendGrid from sending me emails?

Using the SendGrid API You can cancel a scheduled send by making a call to /marketing/singlesends/{id}/schedule where {id} is the ID of the Single Send you want to stop. A successful deletion will return a 200.


1 Answers

I just had this issue: I created an account with SendGrid and tried to get the basic example working, the API would return a 202 response, but the email was never sent, and the SendGrid web UI's activity feed showed no activity.

I submitted a SendGrid support ticket and ~8 hours later received a response saying that they had disabled my account's ability to send emails:

Hello,

Thanks for contacting SendGrid Support!

It looks like your account has been closed by our compliance team and this is the cause of the issue.

To reactivate we’d like to know a little more about the email you’ll be sending through SendGrid. Please elaborate on the following:

  1. The nature of your business, the services you provide, and your potential customer base

  2. Your sending frequency and volume

  3. How you collect your recipient addresses (link to opt in page, or sign up process)

  4. How you will allow your recipients to opt out of your emails (whether you plan to use SendGrid’s one-click unsubscribe feature, or if you have your own method)

  5. The types of messages you will be sending (transactional or marketing)

Please reply at your earliest convenience in order to continue the activation process. Thanks for your cooperation!


~15 hours after submitting my answers, I received a response saying my account had been "activated":

Hi nathan.wailes,

Thanks for the additional information! Your SendGrid account has been activated, and can now be used to send email. To get started, check out our Getting Started page.

If you hit any snags while you're getting set up, you can find solutions to common problems and FAQS in our Knowledge Base.

Let me know if you have any more questions!

Best,

Stevin O.

Associate Support Engineer


When I then ran the basic example code with my email address set up as the recipient, the email showed up immediately in my Gmail inbox.

like image 111
Nathan Wailes Avatar answered Sep 20 '22 15:09

Nathan Wailes