{"id":25410101,"url":"https://github.com/msztolcman/smtpc","last_synced_at":"2025-10-31T04:32:04.401Z","repository":{"id":43710053,"uuid":"347514812","full_name":"msztolcman/smtpc","owner":"msztolcman","description":"SMTPc is simple but powerfull SMTP client for sending emails using CLI. It's dedicated for system admins or developers, however it's easy to use and every CLI user will be satisfied using this.","archived":false,"fork":false,"pushed_at":"2022-02-22T12:26:31.000Z","size":479,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-09T23:17:03.694Z","etag":null,"topics":["cli","developer-experience","developer-tools","email","interactive-smtp","mail","predefined-messages","predefined-profiles","smptc","smtp","smtp-client","smtp-session","templates","templating"],"latest_commit_sha":null,"homepage":"","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/msztolcman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":"msztolcman","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2021-03-14T01:02:48.000Z","updated_at":"2024-08-15T10:13:17.000Z","dependencies_parsed_at":"2022-09-19T09:51:58.630Z","dependency_job_id":null,"html_url":"https://github.com/msztolcman/smtpc","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msztolcman%2Fsmtpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msztolcman%2Fsmtpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msztolcman%2Fsmtpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msztolcman%2Fsmtpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/msztolcman","download_url":"https://codeload.github.com/msztolcman/smtpc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239114257,"owners_count":19583985,"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":["cli","developer-experience","developer-tools","email","interactive-smtp","mail","predefined-messages","predefined-profiles","smptc","smtp","smtp-client","smtp-session","templates","templating"],"created_at":"2025-02-16T09:30:16.413Z","updated_at":"2025-10-31T04:31:59.030Z","avatar_url":"https://github.com/msztolcman.png","language":"Python","funding_links":["https://ko-fi.com/msztolcman"],"categories":[],"sub_categories":[],"readme":"SMTPc\n=====\n\n[![smtpc version](https://img.shields.io/pypi/v/smtpc.svg)](https://pypi.python.org/pypi/smtpc)\n[![smtpc license](https://img.shields.io/pypi/l/smtpc.svg)](https://pypi.python.org/pypi/smtpc)\n[![smtpc python compatibility](https://img.shields.io/pypi/pyversions/smtpc.svg)](https://pypi.python.org/pypi/smtpc)\n[![Downloads](https://static.pepy.tech/personalized-badge/smtpc?period=total\u0026units=international_system\u0026left_color=grey\u0026right_color=yellow\u0026left_text=Downloads)](https://pepy.tech/project/smtpc)\n[![say thanks!](https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg)](https://saythanks.io/to/marcin%40urzenia.net)\n\n`SMTPc` is simple but powerfull SMTP client for sending emails using CLI.\nIt's dedicated for system admins or developers, however it's easy to use\nand every CLI user will be satisfied using this.\n\n`SMTPc` will be useful when:\n- you have to send emails from automated systems (like crons, i.e. some kinds of\n  reports, notifications from NAS etc)\n- you are sending emails with specified structure and content, where only\n  data is changing (templates)\n- you want to send messages using your SMTP provider without worrying about storing\n  or passing credentials\n- you need a tool that will help you debug SMTP session to your SMTP server (interactive\n  session, clean debugs)\n\nIf you like this tool, just [say thanks](https://saythanks.io/to/marcin%40urzenia.net).\n\nCurrent stable version\n----------------------\n\n0.9.2\n\nFeatures\n--------\n\n* Predefined profiles for use with many SMTP servers\n* Predefined messages (with templates!) for sending messages just by referencing the message name\n* Automatically build message from given parameters, do not glue headers manually\n* Passwords stored in an encrypted form (optionally)\n* Edit raw message body just before sending\n* Interactive SMTP session\n* Clean and readable SMTP session logs (if enabled). Especially with\n  [colorama](https://pypi.org/project/colorama/) module (available by default in\n  `smtpc[extended]` version)!\n* SSL and TLS connections, of course\n* You can easily spoof your own messages, by specifying other sender/recipient in\n  message headers, and other one for SMTP session\n* Custom email headers\n* If you have multiple IP addresses available, choose which one you want to use\n* It's all Python!\n\nInstallation\n------------\n\n`SMTPc` should work on any POSIX platform where [Python](http://python.org)\nis available. This includes Linux, macOS/OSX etc.\n\nThe simplest way is to use Python's built-in package system:\n\n    python3 -m pip install 'smtpc[extended]'\n\nIt will install `SMTPc` and related packages for the best user experience. If you want\nto install the basic version without additions (colors, extended Jinja2 templates),\nthen start with:\n\n    python3 -m pip install smtpc\n\nYou can also use [pipx](https://pipxproject.github.io/pipx/) if you don't want to\nmess with system packages and install `SMTPc` in virtual environment:\n\n    pipx install 'smtpc[extended]'\n\nVoila!\n\nPython version\n--------------\n\n`SMTPc` is tested against Python 3.7+. Older Python versions may work, or may not.\n\nHow to use\n----------\n\nFirst, add the account that you want to use for sending. In this example we are using\n[Sendria](https://github.com/msztolcman/sendria), which runs on our local environment:\n\n```bash\nsmtpc profiles add sendria --host 127.0.0.1 --port 1025\n```\n\nYou can verify that the profile is stored:\n\n```bash\nsmtpc profiles list\n```\n\nNow, add a few messages for future use:\n\n```bash\nsmtpc messages add plain --subject 'Some plain email' --body 'Some plain message body' --from plain@smtpc.net --to receiver@smtpc.net\nsmtpc messages add html --subject 'Some html email' --body 'Some \u003cb\u003eHTML\u003c/b\u003e message body' --body-type=html --from html@smtpc.net --to receiver@smtpc.net\nsmtpc messages add alternative --subject 'Some alternative email' --body 'Some plain message body' --body-html 'Some \u003cb\u003eHTML\u003c/b\u003e message body' --from alternative@smtpc.net --to receiver@smtpc.net\n```\n\nYou can verify that your messages are stored:\n\n```bash\nsmtpc messages list\n```\n\nNow, lets send some emails:\n\n```bash\nsmtpc send --profile sendria --message alternative\nsmtpc send --profile sendria --message plain --subject 'Changed subject for plain'\n```\nIn the second example above, we are using a predefined message named `plain`, but with a changed subject.\n\n```bash\nsmtpc messages add default-profile --profile sendria --subject 'Default profile' --body 'Plain email with default profile' --from plain@smtpc.net --to receiver@smtpc.net\nsmtpc send --mesage default-profile # will use profile specified when creating message; `sendria`\n```\n\nHere we have specified some simple email, but together there is saved also profile name.\nNow, send specified message will use this profile by default!\n\nYou don't need to use any predefined profiles or messages. You can just pass them directly when sending:\n\n```bash\nsmtpc send --host 127.0.0.1 --port 1025 --body-type html --subject 'Some html email' --body 'Some \u003cb\u003eHTML\u003c/b\u003e message body' --from not-funny@smtpc.net --to receiver@smtpc.net\n```\n\nBut it's not where the fun is :)\n\nYou can also use your predefined messages as templates:\n\n```bash\nsmtpc messages add template-test --subject 'Some templated email: {{ date }}' --body 'Some templated email body: {{ uuid }}' --from templated@smtpc.net --to receiver@smtpc.net\nsmtpc send --profile sendria --message template-test --template-field \"date=$(date)\" --template-field \"uuid=$(uuidgen)\"\n```\n\nSo when the email is received, the subject will look like this:\n\n```\nSome templated email: Thu Mar 18 19:05:53 CET 2021\n```\n\nand the body will look like this:\n\n```\nSome templated email body: C21B7FF0-C6BC-47C9-B3AC-5554865487E4\n```\n\nIf [Jinja2](https://jinja.palletsprojects.com) module is available,\nyou can use it as a templating engine!\nSee more in [Templating chapter](#Templating).\n\nTemplating\n----------\n\nTemplating can be done in both simple and extended forms. In the simplest case, when\n[Jinja2](https://jinja.palletsprojects.com) module is not found, `SMTPc` can only\nsubstitute simple placeholders with data.\n\nFor example, if you specify the subject as:\n\n```\n--subject \"Now we have {{ date }}\"\n```\n\nand when sending you provide a value:\n\n```\n--template-field \"date=$(date +'%Y-%m-%dT%H:%M:%S%Z')\"\n```\n\nthen in the final email it will look like:\n\n```\nNow we have 2021-03-19T10:56:31CET\n```\n\nBut if you want to add conditions, loops or any other more complex syntax, you will need\nto install [Jinja2](https://jinja.palletsprojects.com) module (more: [Installation](#Installation)).\n\nYou willl then have the full power of one of best templating engines Python has. Here's an example:\n\n```bash\nsmtpc messages add template-test --subject 'Some of my projects, state on {{ date }}' --from templated@smtpc.net --to receiver@smtpc.net --body-type html --body '\u003cp\u003eHere I am!\u003c/p\u003e\n{% if projects %}\n\u003cp\u003eSome of my projects:\u003c/p\u003e\n\u003cul\u003e\n{% for project in projects %}\n    \u003cli\u003e\u003ca href=\"https://github.com/msztolcman/{{ project }}\"\u003e{{ project }}\u003c/a\u003e\u003c/li\u003e\n{% endfor %}\n\u003c/ul\u003e\n{% else %}\n\u003cp\u003eI have no projects to show :(\u003c/p\u003e\n{% endif %}\n\u003cp\u003eThat\u0026#39;s all folks!\u003c/p\u003e'\nsmtpc send --profile sendria --message template-test --template-field \"date=$(date -u +'%Y-%m-%dT%H:%M:%S%Z')\" --template-field-json='projects=[\"sendria\", \"smtpc\", \"versionner\", \"ff\"]'\n```\n\nSo when the email is received, the subject will look like this:\n\n```\nSome of my projects, state on 2021-03-19T10:03:56UTC\n```\n\nand the body (slightly reformatted here):\n\n```html\n\u003cp\u003eHere I am!\u003c/p\u003e\n\u003cp\u003eSome of my projects:\u003c/p\u003e\n\u003cul\u003e\n    \u003cli\u003e\u003ca href=\"https://github.com/msztolcman/sendria\"\u003esendria\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"https://github.com/msztolcman/smtpc\"\u003esmtpc\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"https://github.com/msztolcman/versionner\"\u003eversionner\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"https://github.com/msztolcman/ff\"\u003eff\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eThat\u0026#39;s all folks!\u003c/p\u003e\n```\n\nThere are also available fields from message configuration (like `subject` or `to` addresses).\nThese fields (full list below) are the final values (calculated from `CLI` params to `SMTPc` and\npredefined message configuration). All of them are prefixed with `smtpc_`. This allows for\nmuch better customization of emails.\n\nAvailable predefined fields:\n- `smtpc_subject` - analogous to `--subject`\n- `smtpc_envelope_from` - analogous to `--envelope-from`\n- `smtpc_from` - analogous to `--from`\n- `smtpc_envelope_to` - analogous to `--envelope-to`\n- `smtpc_to` - analogous to `--to`\n- `smtpc_cc` - analogous to `--cc`\n- `smtpc_bcc` - analogous to `--bcc`\n- `smtpc_reply_to` - analogous to `--reply-to`\n- `smtpc_body_type` - analogous to `--body-type`, but it's the final content-type of message\n- `smtpc_raw_body` - True if `--raw-body` was used, and False if not\n- `smtpc_predefined_profile` - almost all informations from profile, if specified (see: `--profile`)\n- `smtpc_predefined_message` - almost all informations from message, if specified (see: `--message`)\n\nYou can read more about Jinja2 capabilities on [Jinja2 homepage](https://jinja.palletsprojects.com).\n\nHelp!\n-----\n\nI'm backend developer, not a frontend guy nor designer... And project requires some logo and/or icon.\nIf you're able to prepare some for this project, do not hesitate to [mail me](mailto:marcin@urzenia.net) :)\n\nAlso, if you have an idea how to enhance `SMTPc`, [please fill the ticket](https://github.com/msztolcman/smtpc/issues).\nEvery idea, every feature request can help you, me and others!\n\nAuthors\n-------\n\n* Marcin Sztolcman ([marcin@urzenia.net](mailto:marcin@urzenia.net))\n\nContact\n-------\n\nIf you like or dislike this software, please do not hesitate to tell me about\nit via email ([marcin@urzenia.net](mailto:marcin@urzenia.net)).\n\nIf you find a bug or have an idea to enhance this tool, please use GitHub's\n[issues](https://github.com/msztolcman/smtpc/issues).\n\nChangeLog\n---------\n\n### v0.10.0\n\n* interactive SMTP session: allows to view and edit every SMTP command before sending\n  it to server\n* predefined message can now have attached default profile\n  that will be used when sending\n* adding `Date` header when building new email message, and there is no custom\n  `Date` specified using `--header` param\n* adding `Message-ID` header when building new email message, and there is no custom\n  `Message-ID` specified using `--header` param\n* added new sending param: `--disable-ehlo` to forcing using `HELO` (by default `EHLO` is\n  used, then `HELO` if first method fails)\n* added new sending and profile param: `--auth-method` to forcing using specified authorization\n  method\n* added new sending param: `--message-dump` to dumping built mime message to STDERR\n* work with older SMTP servers which handle only `HELO` command (doesn't handle newest `EHLO`)\n* fixed issue where `SMTPc` doesn't send `--identify-as` value when using TLS\n\n### v0.9.2\n\n* regression errors fixed\n\n### v0.9.1\n\n* minor bugfixes\n\n### v.0.9.0\n\n* changed way of building message body\n* added template fields from message configuration to templates, with prefix `smtpc_`\n* default subcommand for commands `profiles` and `messages` is `list` now (calling without\n  subcommand will display list of profiles/messages instead of help)\n* allow reading message body from STDIN if no `--body` or `--body=-` is used\n* improved handling rejects from SMTP server\n* added short aliases for main commands: `p` - for `profiles`, `s` for `send`, `m` for `messages`\n* huge improvements for debug messages\n* allow for missing from/envelope_from, to/cc/bcc/envelope_to when\n  adding new predefined message\n* new e2e tests: sending messages\n\n\n### v0.8.1\n\n* fix error related to Content-Type (fixes #2 - thanks for [tuxfamily](https://github.com/tuxfamily) for reporting)\n* fixed grammar and informations in README (thanks to [slawekp](https://github.com/slawekp) for PR)\n* many minor changes reported by linters\n\n### v0.8.0\n\n* `send` and `profiles` commands: ask for password if `--password` param\n  was used with no argument\n* when adding a new profile, you can choose to encrypt your password. In this\n  case you will be asked for encryption key. The same key must be used to\n  decrypt password when sending.\n* added many e2e tests\n\n### v0.7.0\n\n* added `--message-interactive` param for `send` command. Allows editing of\n  raw message body just before sending\n* changed url in `User-Agent` header and when `--version` is called to `smtpc.net`\n* many internal fixes and rewrites, added few new tests\n\n### v0.6.0\n\n* added `--template-field` and `--template-field-json` params for `send` command,\n  allows to replace some `{{ fields }}` in email body or subject with specified\n  values. Or you can also use [Jinja2](https://jinja.palletsprojects.com) if\n  module is installed\n\n### v0.5.0\n\n* safe writing config files: will show file content if writing will fail\n* messages list is simplified by default (just message name like in profiles list)\n* new commands: `smtpc profiles delete`, `smtpc messages delete` - self explanatory I guess :)\n* few minor bugs squashed\n* few internal changes and improvements\n\n### v0.4.1\n\n* fixed handling `--ssl` and `--tls` when sending message using profile\n* added simple `--dry-run` option\n* added `--reply-to` option\n* minor fixes to error handling\n* added `User-Agent` header to generated messages\n\n### v0.4.0\n\n* BC: renamed command: `profile` -\u003e `profiles`\n* added new command: `messages` for managing of saved email messages\n* allow overwriting profile or message predefined options from CLI arguments\n* cleaner and more elegant code\n\n### v0.3.0\n\n* using commands now instead of dozens of CLI arguments\n\n### v0.2.0\n\n* added profiles\n\n### v0.1.1\n\n* fixed `--version`\n\n### v0.1.0\n\n* very initial version\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsztolcman%2Fsmtpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmsztolcman%2Fsmtpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsztolcman%2Fsmtpc/lists"}