{"id":18081914,"url":"https://github.com/vindarel/cl-sendgrid","last_synced_at":"2026-01-31T09:32:28.111Z","repository":{"id":67525126,"uuid":"257566102","full_name":"vindarel/cl-sendgrid","owner":"vindarel","description":"Send emails with SendGrid's API","archived":false,"fork":false,"pushed_at":"2024-01-18T15:03:55.000Z","size":54,"stargazers_count":14,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-26T17:51:15.050Z","etag":null,"topics":["common-lisp","email","email-sender","sendgrid","sendgrid-api"],"latest_commit_sha":null,"homepage":null,"language":"Common Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vindarel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["vindarel"],"ko_fi":"vindarel"}},"created_at":"2020-04-21T10:56:44.000Z","updated_at":"2023-10-31T19:50:56.000Z","dependencies_parsed_at":"2025-06-28T23:31:06.912Z","dependency_job_id":null,"html_url":"https://github.com/vindarel/cl-sendgrid","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/vindarel/cl-sendgrid","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vindarel%2Fcl-sendgrid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vindarel%2Fcl-sendgrid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vindarel%2Fcl-sendgrid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vindarel%2Fcl-sendgrid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vindarel","download_url":"https://codeload.github.com/vindarel/cl-sendgrid/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vindarel%2Fcl-sendgrid/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28936183,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-31T08:53:31.997Z","status":"ssl_error","status_checked_at":"2026-01-31T08:51:38.521Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["common-lisp","email","email-sender","sendgrid","sendgrid-api"],"created_at":"2024-10-31T13:17:12.375Z","updated_at":"2026-01-31T09:32:28.077Z","avatar_url":"https://github.com/vindarel.png","language":"Common Lisp","readme":"# Send emails with the SendGrid API\n\nhttps://sendgrid.com/\n\n# Installation\nOn Quicklisp (2020-10):\n\n    (ql:quickload \"sendgrid\")\n\nand on [Ultralisp](https://ultralisp.org/).\n\n# Current usage (Please jump to [Updated usage](#updated-usage) to see upcoming changes)\nCreate a SendGrid account and set these variables:\n\n```lisp\n(setf *email-config*\n  '(:|api-key| \"your private api key\"\n    :|from| \"the default 'from' address.\"))\n```\n\nSend an email with `send-email`:\n\n```lisp\n(sendgrid:send-email \u0026key to\n                          (from (getf *email-config* :|from|))\n                          (reply-to (getf *email-config* :|reply-to|))\n                          subject\n                          content\n                          (verbose *verbose*))\n\n;; #()\n;; 202\n;; #\u003cHASH-TABLE :TEST EQUAL :COUNT 10 {10079655A3}\u003e\n;; #\u003cQURI.URI.HTTP:URI-HTTPS https://api.sendgrid.com/v3/mail/send\u003e\n;; #\u003cCL+SSL::SSL-STREAM for #\u003cFD-STREAM for \"socket 192.168.1.11:36670, peer: 159.122.xxx.yyy:443\" {1007880183}\u003e\u003e\n```\n\nIt takes the time of a POST request.\n\n# Updated usage\n## API KEY\nAfter obtaining an API key from [SendGrid](https://sendgrid.com/), you can either \n### Provide the API key via an Operating System environment variable\n```lisp\nCL-USER\u003e sendgrid:*api-key-environment-variable-name*\n\"SENDGRID_API_KEY\" ; default environment variable name, you can change it.\n```\nThen you can do it by OS built-in facility, such as\n```bash\nexport SENDGRID_API_KEY=your_sendgrid_api_key_value\n```\nOr set it using UIOP\n```lisp\nCL-USER\u003e (setf (uiop:getenv sendgrid:*api-key-environment-variable-name*) your-api-key-value)\n```\n### Provide the API key when calling `sendgrid:send-mail`\n`api-key` is one of the parameter of `sendgrid:send-mail`\n```lisp\n(sendgrid:send-email \u0026rest rest\n                     \u0026key\n                     to\n                     from\n                     subject\n                     content\n                     reply-to ; if not nil, should be an alist as ((\"email\" . string) (\"name\" . string))\n                     (content-type \"text/plain\")\n                     (api-key (uiop:getenv *api-key-environment-variable-name*))\n                   \u0026allow-other-keys)\n```\n## Sample plain text email\n### Minimum\n```lisp\n(sendgrid:send-email :to \"recipient@example.com\"\n                     :from \"noreply@example.com\"\n                     :subject \"Sending emails from SendGrid is fun!\"\n                     :content \"Sending emails from SendGrid is fun!\")\n```\n### With `reply-to`\n```lisp\n(sendgrid:send-email :to \"recipient@example.com\"\n                     :from \"team@example.com\"\n                     :reply-to '((\"email\" . \"noreply@example.com\") (\"name\" . \"No Reply\"))\n                     :subject \"Sending emails from SendGrid is fun!\"\n                     :content \"Sending emails from SendGrid is fun!\")\n```\n## Sample HTML email\n```lisp\n(sendgrid:send-email :to \"recipient@example.com\"\n                     :from \"noreply@example.com\"\n                     :subject \"Sending emails from SendGrid is fun!\"\n                     :content-type \"text/html\"\n                     :content \"\u003ch1\u003eA title\u003c/h1\u003e\u003cbr/\u003e\u003cstrong\u003eSending emails from SendGrid is fun!\u003c/strong\u003e\")\n```\n## Verbose mode example\n```\n(let ((sendgrid:*verbose* t))\n  (sendgrid:send-email :to \"recipient@example.com\"\n                       :from \"noreply@example.com\"\n                       :subject \"Sending emails from SendGrid is fun!\"\n                       :content-type \"text/html\"\n                       :content \"\u003ch1\u003eA title\u003c/h1\u003e\u003cbr/\u003e\u003cstrong\u003eSending emails from SendGrid is fun!\u003c/strong\u003e\"))\n```\n\n## Optional - Add sender name\n\nWithout a from name, your sending email will be the name of the email. Use the optional `:from-name` key to add a more appropriate sender name.\n\n```lisp\n(sendgrid:send-email :to \"recipient@example.com\"\n\t              :from \"noreply@example.com\"\n\t\t      :from-name \"Jane Doe\"\n\t\t      :subject \"Sending emails from SendGrid is fun!\"\n\t\t      :content-type \"text/html\"\n\t\t      :content \"\u003ch1\u003eA title\u003c/h1\u003e\u003cbr/\u003e\u003cstrong\u003eSending emails from SendGrid is fun!\u003c/strong\u003e\")\n```\n## Email scheduling - :send-at key\n\nThe :send-at key takes a unix epoch time and sends your email at that specific time.\n \nFree sendgrid accounts (at this time - 4th Oct 23) are limited to sending up to 3 days in the future. Therefore the `:send-at` key is limited to sending emails between 1-3 days in the future.\n\n### Send email now\n\nTo send an email now, you can omit the `:send-at` key (see examples above).\n\n### Send email in the future\n\nUse the function `(now-plus-n-days n)` where `n` can be 1, 2, or 3 days in the future. This function will return the epoch time for that future date.\n\n```lisp\n(sendgrid:send-email :to \"recipient@example.com\"\n\t              :from \"noreply@example.com\"\n\t\t      :from-name \"Jane Doe\"\n\t\t      ;; send email 2 days in the future\n\t\t      :send-at (now-plus-n-days 2)\n\t\t      :subject \"Sending emails from SendGrid is fun!\"\n\t\t      :content-type \"text/html\"\n\t\t      :content \"\u003ch1\u003eA title\u003c/h1\u003e\u003cbr/\u003e\u003cstrong\u003eSending emails from SendGrid is fun!\u003c/strong\u003e\")\n```\n\n## Sending emails with .txt attachments\n\nYou can use the `:attachments` key to send attachments. Set attachments to `t` and then you can use the `:file` and `:filename` keys to provide your attachement.\n\n`:file` takes the path to the txt file you want to attach. \n`:filename` takes a string that represents the file name of the attachment.\n\nExample: \n\n```lisp\n(sendgrid:send-email :to \"recipient@example.com\"\n\t              :from \"noreply@example.com\"\n\t\t      :from-name \"Jane Doe\"\n\t\t      :send-at (now-plus-n-days 2)\n\t\t      :subject \"Sending emails from SendGrid is fun!\"\n\t\t      :content-type \"text/html\"\n\t\t      :content \"\u003ch1\u003eA title\u003c/h1\u003e\u003cbr/\u003e\u003cstrong\u003eSending emails from SendGrid is fun!\u003c/strong\u003e\"\n\t\t      :attachments t\n\t\t      :file \"/path/to/txt/file\"\n\t\t      :filename \"filename.txt\")\n```\n\n## Sending emails with `pdf` attachments\n\nEnsure that the `:file` is a path to your pdf file and the `:filename` ends with `.pdf`.\n\n\nExample: \n\n```lisp\n(sendgrid:send-email :to \"recipient@example.com\"\n\t              :from \"noreply@example.com\"\n\t\t      :from-name \"Jane Doe\"\n\t\t      :send-at (now-plus-n-days 2)\n\t\t      :subject \"Sending emails from SendGrid is fun!\"\n\t\t      :content-type \"text/html\" ;; this is the content type of the email, not the attachments.\n\t\t      :content \"\u003ch1\u003eA title\u003c/h1\u003e\u003cbr/\u003e\u003cstrong\u003eSending emails from SendGrid is fun!\u003c/strong\u003e\"\n\t\t      :attachments t\n\t\t      :file \"/path/to/txt/pdf/file\"\n\t\t      :filename \"filename.pdf\")\n```\n\n\nYou will receive an email with the attachment `filename.pdf`. The content of the file will match that of `/path/to/pdf/file`.\n\n\n## Triggering email automations with add-contact-to-list\n\nInside sendgrid, if you navigate to Marketing --\u003e Contacts, you can create a contact list. A contact list is a specific segment of people that did, or will do a specific action. For example, you can have a contact list for new subscribers to your product.\n\nA list can have automatic actions attached to it. For example, you can trigger an email automation based on somebody subscribing to the list (This is managed in Marketing --\u003e Automations).\n\nWith the `add-contact-to-list` function, you can add a single contact to a specifc contact list by using the list-id. \n\nNote - you can find the list-id at the end of the contact list url. For example `https://mc.sendgrid.com/contacts/lists/ac32607e-e253-490b-a171-d84d88xxxxxx`, in this case `ac32607e-e253-490b-a171-d84d88xxxxxx` is the list id.\n\n```lisp\n(add-contact-to-list :email \"vinn@kev.com\"\n                     :firstname \"Vinn\"\n                     :list-id \"ac32607e-e253-490b-a171-d84d88xxxxxx\")\n```\n\n# See also\n\n* https://github.com/40ants/mailgun (Mailgun: just a bit more overhead to getting started, a free plan a bit less free)\n* https://github.com/CodyReichert/awesome-cl#email\n* [spinneret](https://github.com/ruricolist/spinneret) (recommended) or [cl-who](https://edicl.github.io/cl-who/) for generating HTML strings.\n# Licence\n\nMIT.\n","funding_links":["https://github.com/sponsors/vindarel","https://ko-fi.com/vindarel"],"categories":["Interfaces to other package managers"],"sub_categories":["Email"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvindarel%2Fcl-sendgrid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvindarel%2Fcl-sendgrid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvindarel%2Fcl-sendgrid/lists"}