You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am getting a HTTP 400 Bad request response when calling sendgrid email, BUT THE EMAIL IS GETTING SENT OUT. I expect if error is getting returned then the email should not be delivered.
Issue Summary
I am getting a HTTP 400 Bad request response when calling sendgrid email, BUT THE EMAIL IS GETTING SENT OUT. I expect if error is getting returned then the email should not be delivered.
Steps to Reproduce
Code Snippet
sg = sendgrid.SendGridAPIClient(settings.SENDGRID_API_KEY)
template_data = Content("text/html", template)
to_email = Email(to_email)
mail = Mail(from_email, subject, to_email, template_data)
response = sg.client.mail.send.post(request_body=mail.get())
Here is the output of mail.get()
{
"from":{
"email":"[email protected]"
},
"subject":"Employees trainings are due on 2020-01-24",
"personalizations":[
{
"to":[
{
"email":""
}
]
}
],
"content":[
{
"type":"text/html",
"value":"<!DOCTYPE html\n PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n<html xmlns="http://www.w3.org/1999/xhtml">\n\n\n <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1">\n <title>SecurityAdvisor</title>\n <style type="text/css">\n table,\n td {\n mso-table-lspace: 0;\n mso-table-rspace: 0 !important\n }\n\n span.preheader {\n display: none !important;\n }\n\n @media only screen and (max-width: 768px) {\n table[class=contentTableOuter] {\n width: 95%\n }\n\n table[class=contentTableInner] {\n width: 95%;\n margin: 0 auto\n }\n\n table[class=fLeft],\n table[class=fRight] {\n width: 100%;\n margin-bottom: 10px;\n border: none\n }\n\n table[class=fLeft] td,\n table[class=fRight] td {\n height: auto;\n border: none;\n text-align: center\n }\n\n img[class=resImg] {\n width: 100% !important;\n height: auto !important\n }\n\n .d-none {\n display: none\n }\n }\n\n </style>\n\n\n\n<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#ececec">\n \n <td align="center" valign="top" bgcolor="#ececec" height="20"> \n \n \n <td align="center" valign="top" bgcolor="#ececec">\n\n <table width="700" border="0" align="center" cellpadding="10" cellspacing="0" class="contentTableOuter">\n \n <td align="center" valign="top" bgcolor="#FFFFFF">\n <table width="600" border="0" align="center" cellpadding="0" cellspacing="0" class="contentTableInner">\n \n <td align="left" valign="top">\n <table width="100%" border="0" align="left" cellpadding="20" cellspacing="0" class="fLeft">\n \n <td align="center" valign="middle">\n <a href="https://www.securityadvisor.io/" target="_blank">\n <img src="https://logouploadtest.s3.amazonaws.com/OrganisationLogo/305cd33aa1cc49ba945eb86844e1683c" alt="" width="300" border="0" />\n \n \n \n \n \n <td align="left" valign="top">\n <hr width="100%" size="1" noshade="noshade" style="border:1px solid #f1f1f2">\n \n \n \n <td height="20" align="left" valign="top"> \n \n <tr contenteditable="true">\n <td style="padding: 15px;">\n <p style="font-size: 15px;">Hello Manager
\n
This is a reminder. The following trainings are due to be completed by the users by January 24, 2020
\n\n \n- \n
\n \n
\nCalifornia Consumer Privacy Act : <a href="https://localhost:8001/gw/c2c7f4bd55754f068fff5a13f4d1d243/"> Click here to start
\n\n
Users List
\n\n \n- \n
\n \n - \n
\n \n
\n\nYahoo Yahoo last name - [email protected]
\n[email protected] - [email protected]
\nRegards,
\nYour Information Security Team
\n \n \n \n \n \n \n\n \n <td align="right" valign="top" bgcolor="#666666"\n style="font-size: 13px; font-family:Arial, Helvetica, sans-serif; color:#ffffff">\n\n Powered by SecurityAdvisor\n <a href="https://www.securityadvisor.io" target="_blank" style="color:#fff; text-decoration: none">\n <img src="https://content.securityadvisor.io/static/assets/images/securityadvisor-logo-footer.png"\n align="center" width="120" alt="SecurityAdvisor" border="0" class="" style="padding-left:10px" />\n \n \n\n \n <td align="center" valign="top" bgcolor="#ececec"\n style="font-size: 12px; font-family:Arial, Helvetica, sans-serif; color:#666">\n You received this email because your organization is registered with SecurityAdvisor. Please contact your\n administrator to unsubscribe.\n\n We respect your privacy. View our <a href="https://www.securityadvisor.io/sabweb/privacy" target="_blank"\n style="color:#666">Privacy Policy.\n \n \n\n \n \n \n\n \n <td align="center" valign="top" bgcolor="#ececec" height="20"> \n \n\n\n\n\n"
}
]
}
Exception/Log
HTTP Error 400: Bad Request
Technical details:
The text was updated successfully, but these errors were encountered: