Title: Commas in recipient name cause mail to be silently dropped (worked in v2) · Issue #291 · sendgrid/sendgrid-python · GitHub
Open Graph Title: Commas in recipient name cause mail to be silently dropped (worked in v2) · Issue #291 · sendgrid/sendgrid-python
X Title: Commas in recipient name cause mail to be silently dropped (worked in v2) · Issue #291 · sendgrid/sendgrid-python
Description: Issue Summary When sending a message, if a recipient name contains a comma, the send appears to succeed but the message ends up with a "dropped" status and is never delivered. The equivalent code worked correctly (successfully delivered ...
Open Graph Description: Issue Summary When sending a message, if a recipient name contains a comma, the send appears to succeed but the message ends up with a "dropped" status and is never delivered. The equivalent code w...
X Description: Issue Summary When sending a message, if a recipient name contains a comma, the send appears to succeed but the message ends up with a "dropped" status and is never delivered. The equival...
Opengraph URL: https://github.com/sendgrid/sendgrid-python/issues/291
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Commas in recipient name cause mail to be silently dropped (worked in v2)","articleBody":"#### Issue Summary\r\n\r\nWhen sending a message, if a recipient `name` contains a comma, the send appears to succeed but the message ends up with a \"dropped\" status and is never delivered.\r\n\r\nThe equivalent code worked correctly (successfully delivered the message -- including the comma in the recipient's display-name) with the v2 send API.\r\n\r\nI'm aware the [v3 send docs](https://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/index.html#-Limitations) indicate you can't include commas or semicolons (or -- erroneously, periods) in recipient names. But there are many legitimate cases where a display-name would include a comma. And since commas *are* allowed (and work) in the from_email name, it's confusing that the v3 API wouldn't be properly quoting recipient display-names like the v2 API did.\r\n\r\n\r\n#### Steps to Reproduce\r\n\r\n1. Test with v3 API:\r\n\r\n `pip install sendgrid==3.6.3` (current version as of this report) and run this code:\r\n\r\n ```python\r\n import os\r\n import sendgrid\r\n from sendgrid.helpers.mail import Mail, Email, Content\r\n \r\n sg = sendgrid.SendGridAPIClient(apikey=os.environ.get('SENDGRID_API_KEY'))\r\n mail = Mail(\r\n from_email=Email(\"widgets-inc@example.com\", \"Widgets, Inc.\"),\r\n to_email=Email(\"ckaes@sink.sendgrid.net\", \"Mr. Craig Kaes, SVP Eng.\"),\r\n subject=\"Sent using v3 API\",\r\n content=Content(\"text/plain\", \"Body\"),\r\n )\r\n response = sg.client.mail.send.post(request_body=mail.get())\r\n print(response.status_code, response.body) # (202, '')\r\n ```\r\n\r\n Results: `(202, '')` (send accepted; no apparent error)\r\n\r\n2. Find the message in your SendGrid [activity feed](https://app.sendgrid.com/email_activity).\r\n\r\n Results: The message has been dropped (and displays the confusing email address \"mr.craig\"):\r\n \u003cimg width=\"225\" alt=\"screen shot 2017-01-17 at 11 58 29 am\" src=\"https://cloud.githubusercontent.com/assets/639984/22037518/4c9054d0-dcac-11e6-83fb-6d8ba4a99c71.png\">\r\n Expected: The message should have been processed and delivered\r\n\r\n3. Now remove the comma from the `to_email` -- but leave it in the `from_email`, and send again.\r\n\r\n Results: Message is processed and delivered, with the comma intact in the `from_email` display-name. (This demonstrates that the v3 API correctly handles commas in names in *some* cases. So the code to properly escape and quote names must exist somewhere in the v3 API.)\r\n\r\n4. Now test with the v2 send API:\r\n\r\n `pip install sendgrid==2.2.1` (last release using v2 send) and run this code -- the equivalent of the v3 example above:\r\n\r\n ```python\r\n import os\r\n import sendgrid\r\n \r\n sg = sendgrid.SendGridClient(os.environ.get('SENDGRID_API_KEY'))\r\n message = sendgrid.Mail(\r\n from_email=\"widgets-inc@example.com\",\r\n from_name=\"Widgets, Inc.\",\r\n to=\"ckaes@sink.sendgrid.net\",\r\n to_name=\"Mr. Craig Kaes, SVP Eng.\",\r\n subject=\"Sent using v2 API\",\r\n text=\"Body\",\r\n )\r\n status, msg = sg.send(message)\r\n print(status, msg) # (200, '{\"message\":\"success\"}')\r\n ```\r\n\r\n Results: The message is processed and delivered, with the comma in the recipient's display-name intact. The activity feed confirms:\r\n \u003cimg width=\"279\" alt=\"screen shot 2017-01-17 at 12 11 14 pm\" src=\"https://cloud.githubusercontent.com/assets/639984/22037946/1828787e-dcae-11e6-8327-27621d0a78a6.png\">\r\n\r\n\r\n#### Technical details:\r\n\r\n* sendgrid-python Version: as identified in examples above\r\n* Python Version: 2.7.12","author":{"url":"https://github.com/medmunds","@type":"Person","name":"medmunds"},"datePublished":"2017-01-17T20:16:50Z","url":"https://github.com/sendgrid/sendgrid-python/issues/291"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:1be32a0f-9fa7-ab03-8eec-a6aa1c7ae02d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8FBC:1087D4:2A06EAC:382F8CD:6B01C543 |
| html-safe-nonce | 0d6cf479eb25ccc3b4fa9cbaab91b01f8feaf1d358825c3b29fc0bffc8b5d48e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RkJDOjEwODdENDoyQTA2RUFDOjM4MkY4Q0Q6NkIwMUM1NDMiLCJ2aXNpdG9yX2lkIjoiNDk5OTE1ODA2MjQ5NDM2OTA5MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 2a5bd27aeee9327b76c2f79a83e1edf23c981b240a8647482374ed32f764b8bb |
| hovercard-subject-tag | issue:201393954 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/sendgrid/sendgrid-python/291/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f7a17b3acfde8ec059c3e1f7e633e2a00fc1572f67c57ba3b92783f57ba4f861/sendgrid/sendgrid-python/issues/291 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f7a17b3acfde8ec059c3e1f7e633e2a00fc1572f67c57ba3b92783f57ba4f861/sendgrid/sendgrid-python/issues/291 |
| og:image:alt | Issue Summary When sending a message, if a recipient name contains a comma, the send appears to succeed but the message ends up with a "dropped" status and is never delivered. The equivalent code w... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | medmunds |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/sendgrid/sendgrid-python git https://github.com/sendgrid/sendgrid-python.git |
| octolytics-dimension-user_id | 181234 |
| octolytics-dimension-user_login | sendgrid |
| octolytics-dimension-repository_id | 3546794 |
| octolytics-dimension-repository_nwo | sendgrid/sendgrid-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3546794 |
| octolytics-dimension-repository_network_root_nwo | sendgrid/sendgrid-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width