{"id":23200671,"url":"https://github.com/templateless/templateless-python","last_synced_at":"2025-04-05T09:25:21.879Z","repository":{"id":221429893,"uuid":"753659463","full_name":"templateless/templateless-python","owner":"templateless","description":"Send transactional emails in Python using just code","archived":false,"fork":false,"pushed_at":"2024-03-24T15:05:46.000Z","size":47,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-25T19:01:55.060Z","etag":null,"topics":["email-design","email-development","email-marketing","email-sender","email-sender-tool","email-template","emails","python","templateless","transactional-emails"],"latest_commit_sha":null,"homepage":"https://templateless.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/templateless.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-06T14:58:48.000Z","updated_at":"2024-02-07T22:18:50.000Z","dependencies_parsed_at":"2024-02-07T23:27:14.746Z","dependency_job_id":"bb3c2625-9d51-4fa5-bc6d-d2feb48f02d0","html_url":"https://github.com/templateless/templateless-python","commit_stats":null,"previous_names":["templateless/templateless-python"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/templateless%2Ftemplateless-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/templateless%2Ftemplateless-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/templateless%2Ftemplateless-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/templateless%2Ftemplateless-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/templateless","download_url":"https://codeload.github.com/templateless/templateless-python/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247314147,"owners_count":20918774,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["email-design","email-development","email-marketing","email-sender","email-sender-tool","email-template","emails","python","templateless","transactional-emails"],"created_at":"2024-12-18T15:12:13.726Z","updated_at":"2025-04-05T09:25:21.855Z","avatar_url":"https://github.com/templateless.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  \u003ca href=\"https://templateless.com/\"\u003e\n    \u003cimg src=\"templateless.webp\" alt=\"Templateless\" width=\"450px\"\u003e\n  \u003c/a\u003e\n  \u003cbr /\u003e\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cb\u003eShip faster by treating email as code 🚀\u003c/b\u003e \u003cbr /\u003e\n\u003c/p\u003e\n\n\u003ch4 align=\"center\"\u003e\n  \u003ca href=\"https://templateless.com/\"\u003eWebsite\u003c/a\u003e \u0026bull;\n  \u003ca href=\"https://app.templateless.com/\"\u003eGet Your API Key\u003c/a\u003e \u0026bull;\n  \u003ca href=\"https://twitter.com/templateless\"\u003eTwitter\u003c/a\u003e\n\u003c/h4\u003e\n\n---\n\n[![PyPI package](https://badge.fury.io/py/templateless.svg)](https://pypi.org/project/templateless/)\n[![Github Actions](https://img.shields.io/github/actions/workflow/status/templateless/templateless-python/tests.yml)](https://github.com/templateless/templateless-python/actions)\n[![Downloads](https://img.shields.io/pypi/dm/templateless)](https://pypi.org/project/templateless/)\n[![X (formerly Twitter) Follow](https://img.shields.io/twitter/follow/Templateless)](https://twitter.com/templateless)\n\n[Templateless](https://templateless.com) lets you generate and send transactional emails quickly and easily so you can focus on building your product.\n\nIt's perfect for SaaS, web apps, mobile apps, scripts and anywhere you have to send email programmatically.\n\n## ✨ Features\n\n- 👋 **Anti drag-and-drop by design** — emails are a part of your code\n- ✅ **Components as code** — function calls turn into email HTML components\n- 💻 **SDK for any language** — use your favorite [programming language](https://github.com/orgs/templateless/repositories)\n- 🔍 **Meticulously tested** — let us worry about email client compatibility\n- 💌 **Use your favorite ESP** — Amazon SES, SendGrid, Mailgun + more\n- 💪 **Email infrastructure** — rate-limiting, retries, scheduling + more\n- ⚡ **Batch sending** — send 1 email or 1,000 with one API call\n\n## 🚀 Getting started\n\nInstall the package from PyPI, e. g. with pip:\n\n```bash\npip install templateless\n```\n\nImport the `Templateless` class from the `templateless` package:\n\n```python\nfrom templateless import Templateless\ntemplateless = Templateless()\n```\n\n## 🔑 Get Your API Key\n\nYou'll need an API key for the example below ⬇️\n\n[![Get Your API Key](https://img.shields.io/badge/Get_Your_API_Key-free-blue?style=for-the-badge)](https://app.templateless.com/)\n\n- 3,000 emails per month\n- All popular email provider integrations\n- Start sending right away\n\n## 👩‍💻 Quick example\n\nThis is all it takes to send a signup confirmation email:\n\n```python\nfrom templateless import Content, Email, EmailAddress, Templateless\n\n\ndef main():\n    content = (\n        Content()\n        .text(\"Hi, please **confirm your email**:\")\n        .button(\"Confirm Email', 'https://your-company.com/signup/confirm?token=XYZ\")\n        .build()\n    )\n\n    email = (\n        Email()\n        .to(EmailAddress(\"\u003cYOUR_CUSTOMERS_EMAIL_ADDRESS\u003e\"))\n        .subject(\"Confirm your signup 👋\")\n        .content(content)\n        .build()\n    )\n\n    templateless = Templateless(\"\u003cYOUR_API_KEY\u003e\")\n    templateless.send(email)\n\n\nif __name__ == \"__main__\":\n    main()\n```\n\nThere are more examples in the [examples](examples) folder ✨\n\n\u003e [!NOTE]\n\u003e 🚧 **The SDK is not stable yet.** This API might change as more features are added. Please watch the repo for the changes in the [CHANGELOG](CHANGELOG.md).\n\n## 🏗 Debugging\n\nYou can generate _test API keys_ by activating the **Test Mode** in your dashboard. By using these keys, you'll be able to view your fully rendered emails without actually sending them.\n\nWhen you use a test API key in your SDK, the following output will appear in your logs when you try to send an email:\n\n```log\nTemplateless [TEST MODE]: Emailed user@example.com, preview: https://tmpl.sh/ATMxHLX4r9aE\n```\n\nThe preview link will display the email, but you must be logged in to Templateless to view it.\n\n## 🔳 Components\n\nEmails are crafted programmatically by making function calls. There's no dealing with HTML or drag-and-drop builders.\n\nAll of the following components can be mixed and matched to create dynamic emails:\n\n\u003cdetails\u003e\n  \u003csummary\u003eText / Markdown\u003c/summary\u003e\n\nText component allow you to insert a paragraph. Each paragraph supports basic markdown:\n\n- Bold text: `**bold text**`\n- Italic text: `_italic text_`\n- Link: `[link text](https://example.com)`\n- Also a link: `\u003chttps://example.com\u003e`\n- Headers (h1-h6):\n\n  - `# Big Header`\n  - `###### Small Header`\n\n- Unordered list:\n\n  ```md\n  - item one\n  - item two\n  - item three\n  ```\n\n- Ordered list:\n\n  ```md\n  1. item one\n  1. item two\n  1. item three\n  ```\n\n```python\ncontent = (\n  Content()\n  .text(\"## Thank you for signing up\")\n  .text(\"Please **verify your email** by [clicking here](https://example.com/confirm?token=XYZ)\")\n  .build()\n)\n```\n\n\u003c/details\u003e\n\u003cdetails\u003e\u003csummary\u003eLink\u003c/summary\u003e\n\nLink component adds an anchor tag. This is the same as a text component with the link written in markdown:\n\n```python\ncontent = (\n  Content()\n  .link(\"Confirm Email\", \"https://example.com/confirm?token=XYZ\")\n  .build()\n)\n```\n\n\u003c/details\u003e\n\u003cdetails\u003e\u003csummary\u003eButton\u003c/summary\u003e\n\nButton can also be used as a call to action. Button color is set via your dashboard's app color.\n\n```python\ncontent = (\n  Content()\n  .button(\"Confirm Email\", \"https://example.com/confirm?token=XYZ\")\n  .build()\n)\n```\n\n\u003c/details\u003e\n\u003cdetails\u003e\u003csummary\u003eImage\u003c/summary\u003e\n\nImage component will link to an image within your email. Keep in mind that a lot of email clients will prevent images from being loaded automatically for privacy reasons.\n\n```python\ncontent = (\n  Content()\n  .image(\n    \"https://placekitten.com/300/200\",  # where the image is hosted\n    \"https://example.com\",              # [optional] link url, if you want it to be clickable\n    300,                                # [optional] width\n    200,                                # [optional] height\n    \"Alt text\",                         # [optional] alternate text\n  )\n  .build()\n)\n```\n\nOnly the `src` parameter is required; everything else is optional.\n\n**If you have \"Image Optimization\" turned on:**\n\n1. Your images will be cached and distributed by our CDN for faster loading. The cache does not expire. If you'd like to re-cache, simply append a query parameter to the end of your image url.\n1. Images will be converted into formats that are widely supported by email clients. The following image formats will be processed automatically:\n\n    - Jpeg\n    - Png\n    - Gif\n    - WebP\n    - Tiff\n    - Ico\n    - Bmp\n    - Svg\n\n1. Maximum image size is 5MB for free accounts and 20MB for paid accounts.\n1. You can specify `width` and/or `height` if you'd like (they are optional). Keep in mind that images will be scaled down to fit within the email theme, if they're too large.\n\n\u003c/details\u003e\n\u003cdetails\u003e\u003csummary\u003eOne-Time Password\u003c/summary\u003e\n\nOTP component is designed for showing temporary passwords and reset codes.\n\n```python\ncontent = (\n  Content()\n  .text(\"Here's your **temporary login code**:\")\n  .otp(\"XY78-2BT0-YFNB-ALW9\")\n  .build()\n)\n```\n\n\u003c/details\u003e\n\u003cdetails\u003e\u003csummary\u003eSocial Icons\u003c/summary\u003e\n\nYou can easily add social icons with links by simply specifying the username. Usually, this component is placed in the footer of the email.\n\nThese are all the supported platforms:\n\n```python\ncontent = (\n  Content()\n  .socials(\n    [\n      SocialItem(Service.WEBSITE, \"https://example.com\"),\n      SocialItem(Service.EMAIL, \"username@example.com\"),\n      SocialItem(Service.PHONE, \"123-456-7890\"), # `tel:` link\n      SocialItem(Service.FACEBOOK, \"Username\"),\n      SocialItem(Service.YOUTUBE, \"ChannelID\"),\n      SocialItem(Service.TWITTER, \"Username\"),\n      SocialItem(Service.X, \"Username\"),\n      SocialItem(Service.GITHUB, \"Username\"),\n      SocialItem(Service.INSTAGRAM, \"Username\"),\n      SocialItem(Service.LINKEDIN, \"Username\"),\n      SocialItem(Service.SLACK, \"Org\"),\n      SocialItem(Service.DISCORD, \"Username\"),\n      SocialItem(Service.TIKTOK, \"Username\"),\n      SocialItem(Service.SNAPCHAT, \"Username\"),\n      SocialItem(Service.THREADS, \"Username\"),\n      SocialItem(Service.TELEGRAM, \"Username\"),\n      SocialItem(Service.MASTODON, \"@Username@example.com\"),\n      SocialItem(Service.RSS, \"https://example.com/blog\"),\n    ]\n  )\n  .build()\n)\n```\n\n\u003c/details\u003e\n\u003cdetails\u003e\u003csummary\u003eView in Browser\u003c/summary\u003e\n\nIf you'd like your recipients to be able to read the email in a browser, you can add the \"view in browser\" component that will automatically generate a link. Usually, this is placed in the header or footer of the email.\n\nYou can optionally provide the text for the link. If none is provided, default is used: \"View in browser\"\n\n**Anyone who knows the link will be able to see the email.**\n\n```python\ncontent = (\n  Content()\n  .view_in_browser(\"Read Email in Browser\")\n  .build()\n)\n```\n\n\u003c/details\u003e\n\u003cdetails\u003e\u003csummary\u003eStore Badges\u003c/summary\u003e\n\nLink to your mobile apps via store badges:\n\n```python\ncontent = (\n  Content()\n  .store_badges(\n    [\n      StoreBadgeItem(StoreBadge.APP_STORE, \"https://apps.apple.com/us/app/example/id1234567890\"),\n      StoreBadgeItem(StoreBadge.GOOGLE_PLAY, \"https://play.google.com/store/apps/details?id=com.example\"),\n      StoreBadgeItem(StoreBadge.MICROSOFT_STORE, \"https://apps.microsoft.com/detail/example\"),\n    ]\n  )\n  .build()\n)\n```\n\n\u003c/details\u003e\n\u003cdetails\u003e\u003csummary\u003eQR Code\u003c/summary\u003e\n\nYou can also generate QR codes on the fly. They will be shown as images inside the email.\n\nHere are all the supported data types:\n\n```python\n# url\ncontent = (\n  Content()\n  .qr_code(\"https://example.com\")\n  .build()\n)\n\n# email\ncontent = (\n  Content()\n  .component(QrCode.email(\"user@example.com\"))\n  .build()\n)\n\n# phone\ncontent = (\n  Content()\n  .component(QrCode.phone(\"123-456-7890\"))\n  .build()\n)\n\n# sms / text message\ncontent = (\n  Content()\n  .component(QrCode.sms(\"123-456-7890\"))\n  .build()\n)\n\n# geo coordinates\ncontent = (\n  Content()\n  .component(QrCode.coordinates(37.773972, -122.431297))\n  .build()\n)\n\n# crypto address (for now only Bitcoin and Ethereum are supported)\ncontent = (\n  Content()\n  .component(QrCode.cryptocurrency_address(Cryptocurrency.BITCOIN, \"1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa\"))\n  .build()\n)\n\n# you can also encode any binary data\ncontent = (\n  Content()\n  .component(QrCode.new(bytes([1, 2, 3])))\n  .build()\n)\n```\n\n\u003c/details\u003e\n\u003cdetails\u003e\u003csummary\u003eSignature\u003c/summary\u003e\n\nGenerated signatures can be added to your emails to give a bit of a personal touch. This will embed an image with your custom text using one of several available fonts:\n\n```python\n# signature with a default font\ncontent = (\n  Content()\n  .signature(\"John Smith\")\n  .build()\n)\n\n# signature with a custom font\ncontent = (\n  Content()\n  .signature(\"John Smith\", SignatureFont.REENIE_BEANIE)\n  .build()\n)\n```\n\nThese are the available fonts:\n\n- `SignatureFont.REENIE_BEANIE` [preview →](https://fonts.google.com/specimen/Reenie+Beanie)\n- `SignatureFont.MEOW_SCRIPT` [preview →](https://fonts.google.com/specimen/Meow+Script)\n- `SignatureFont.CAVEAT` [preview →](https://fonts.google.com/specimen/Caveat)\n- `SignatureFont.ZEYADA` [preview →](https://fonts.google.com/specimen/Zeyada)\n- `SignatureFont.PETEMOSS` [preview →](https://fonts.google.com/specimen/Petemoss)\n\nSignature should not exceed 64 characters. Only alphanumeric characters and most common symbols are allowed.\n\n\u003c/details\u003e\n\n---\n\nComponents can be placed in the header, body and footer of the email. Header and footer styling is usually a bit different from the body (for example the text is smaller).\n\n```python\n# header of the email\nheader = Header().text(\"Smaller text\").build()\n\n# body of the email\ncontent = Content().text(\"Normal text\").build()\n```\n\nCurrently there are 2 themes to choose from: `Theme.UNSTYLED` and `Theme.SIMPLE`\n\n```python\ncontent = (\n  Content()\n  .theme(Theme.SIMPLE)\n  .text(\"Hello world\")\n  .build()\n)\n```\n\n## 🤝 Contributing\n\n- Contributions are more than welcome\n- Please **star this repo** for more visibility \u003c3\n\n## 📫 Get in touch\n\n- For customer support feel free to email us at [github@templateless.com](mailto:github@templateless.com)\n\n- Have suggestions or want to give feedback? Here's how to reach us:\n\n    - For feature requests, please [start a discussion](https://github.com/templateless/templateless-python/discussions)\n    - Found a bug? [Open an issue!](https://github.com/templateless/templateless-python/issues)\n    - Say hi [@Templateless](https://twitter.com/templateless) 👋\n\n## 🍻 License\n\n[MIT](LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftemplateless%2Ftemplateless-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftemplateless%2Ftemplateless-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftemplateless%2Ftemplateless-python/lists"}