Closed s2t2 closed 1 year ago
From a student:
For those having "email forbidden" issues, are you using the same email that you used for your sendgrid account? I was having a similar issue for another project and that solved it
Some see "your account is temporarily under review"s
Another student shared the email message from sendgrid that provides additional instructions:
We can probably use the "single sender" approach.
EDIT, yes another student verifies this
I had to do the single sender verification on SendGrid in order to use my own API key.
UPDATE: another student says one way to do the verification process is through the settings menu:
I have verified it is working. Need to setup single sender verification first. Then the following code should work. Also note the key with mail only didn't work. Full access API Key works. Would need to figure out the exact permissions needed to send an email.
# adapted from:
# ... https://github.com/sendgrid/sendgrid-python/blob/main/USAGE.md
# ... https://github.com/sendgrid/sendgrid-python#with-mail-helper-class
from sendgrid import SendGridAPIClient
sg = SendGridAPIClient(api_key=API_KEY)
from sendgrid.helpers.mail import Email, To, Content, Mail
from_email = Email("prof.mj.rossetti+sendgrid@gmail.com") # NEEDS TO MATCH VERIFIED SINGLE SENDER
to_email = To("prof.mj.rossetti+receiver@gmail.com")
subject = "Sending with SendGrid is Fun"
content = Content("text/plain", "and easy to do anywhere, even with Python")
mail = Mail(from_email, to_email, subject, content)
response = sg.client.mail.send.post(request_body=mail.get())
print(response.status_code)
print(response.body)
print(response.headers)
Need to also verify templates are still working: https://github.com/sendgrid/sendgrid-python/blob/main/use_cases/transactional_templates.md
Some students are seeing that SendGrid has disabled / suspended their account:
Resolution Steps:
Sendgrid keeps causing unnecessary issues for students.
Some students had their credentials revoked due to lack of use (even though we are actively using the credentials within the span of a single semester). This is a really dumb and investor deceptive practice on the part of Sendgrid that results in an artificially inflated number of accounts. I've emailed them about this and they refuse to fix the policy.
Other students have reached the max allowable emails limit:
The problem was that I went over the daily(or monthly?) limit of emails for a free sendgrid account. ... I got the issue fixed by using my groupmate's sendgrid credentials.
Using mailgun now
Students are having various issues with getting a working Sendgrid API Key. Posting possible solutions here.