![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
SMTPc
is a simple SMTP client for easy mail sending using CLI. It's dedicated
for developers, however it's easy to use and every CLI user will be satisfied
using this.
The main purpose of SMTPc
is to help developers test and/or verify SMTP servers or
their SMTP configuration. Of course, it can be used in every place you want
to automate any system, and use predefined messages (with templates) for
notifications, like daemons or crons.
If you like this tool, just say thanks.
0.9.2
smtpc[extended]
version)!SMTPc
should work on any POSIX platform where Python
is available. This includes Linux, macOS/OSX etc.
The simplest way is to use Python's built-in package system:
python3 -m pip install 'smtpc[extended]'
It will install SMTPc
and related packages for the best user experience. If you want
to install the basic version without additions (colors, extended Jinja2 templates),
then start with:
python3 -m pip install smtpc
You can also use pipx if you don't want to
mess with system packages and install SMTPc
in virtual environment:
pipx install smtpc
Voila!
SMTPc
is tested against Python 3.7+. Older Python versions may work, or may not.
First, add the account that you want to use for sending. In this example we are using Sendria, which runs on our local environment:
smtpc profiles add sendria --host 127.0.0.1 --port 1025
You can verify that the profile is stored:
smtpc profiles list
Now, add a few messages for future use:
smtpc messages add plain --subject 'Some plain email' --body 'Some plain message body' --from plain@smtpc.net --to receiver@smtpc.net
smtpc messages add html --subject 'Some html email' --body 'Some <b>HTML</b> message body' --body-type=html --from html@smtpc.net --to receiver@smtpc.net
smtpc messages add alternative --subject 'Some alternative email' --body 'Some plain message body' --body-html 'Some <b>HTML</b> message body' --from alternative@smtpc.net --to receiver@smtpc.net
You can verify that your messages are stored:
smtpc messages list
Now, lets send some emails:
smtpc send --profile sendria --message alternative
smtpc send --profile sendria --message plain --subject 'Changed subject for plain'
In the second example above, we are using a predefined message named plain
, but with a changed subject.
You don't need to use any predefined profiles or messages. You can just pass them directly when sending:
smtpc send --host 127.0.0.1 --port 1025 --body-type html --subject 'Some html email' --body 'Some <b>HTML</b> message body' --from not-funny@smtpc.net --to receiver@smtpc.net
But it's not where the fun is :)
You can also use your predefined messages as templates:
smtpc messages add template-test --subject 'Some templated email: {{ date }}' --body 'Some templated email body: {{ uuid }}' --from templated@smtpc.net --to receiver@smtpc.net
smtpc send --profile sendria --message template-test --template-field "date=$(date)" --template-field "uuid=$(uuidgen)"
So when the email is received, the subject will look like this:
Some templated email: Thu Mar 18 19:05:53 CET 2021
and the body will look like this:
Some templated email body: C21B7FF0-C6BC-47C9-B3AC-5554865487E4
If Jinja2 module is available, you can use it as a templating engine! See more in Templating chapter.
Templating can be done in both simple and extended forms. In the simplest case, when
Jinja2 module is not found, SMTPc
can only
substitute simple placeholders with data.
For example, if you specify the subject as:
--subject "Now we have {{ date }}"
and when sending you provide a value:
--template-field "date=$(date +"%Y-%m-%dT%H:%M:%S%Z")"
then in the final email it will look like:
Now we have 2021-03-19T10:56:31CET
But if you want to add conditions, loops or any other more complex syntax, you will need to install Jinja2 module (more: Installation).
You willl then have the full power of one of best templating engines Python has. Here's an example:
smtpc messages add template-test --subject 'Some of my projects, state on {{ date }}' --from templated@smtpc.net --to receiver@smtpc.net --body-type html --body '<p>Here I am!</p>
{% if projects %}
<p>Some of my projects:</p>
<ul>
{% for project in projects %}
<li><a href="https://github.com/msztolcman/{{ project }}">{{ project }}</a></li>
{% endfor %}
</ul>
{% else %}
<p>I have no projects to show :(</p>
{% endif %}
<p>That's all folks!</p>'
smtpc 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"]'
So when the email is received, the subject will look like this:
Some of my projects, state on 2021-03-19T10:03:56UTC
and the body (slightly reformatted here):
<p>Here I am!</p>
<p>Some of my projects:</p>
<ul>
<li><a href="https://github.com/msztolcman/sendria">sendria</a></li>
<li><a href="https://github.com/msztolcman/smtpc">smtpc</a></li>
<li><a href="https://github.com/msztolcman/versionner">versionner</a></li>
<li><a href="https://github.com/msztolcman/ff">ff</a></li>
</ul>
<p>That's all folks!</p>
There are also available fields from message configuration (like subject
or to
addresses).
These fields (full list below) are the final values (calculated from CLI
params to SMTPc
and
predefined message configuration). All of them are prefixed with smtpc_
. This allows for
much better customization of emails.
Available predefined fields:
smtpc_subject
- analogous to --subject
smtpc_envelope_from
- analogous to --envelope-from
smtpc_from
- analogous to --from
smtpc_envelope_to
- analogous to --envelope-to
smtpc_to
- analogous to --to
smtpc_cc
- analogous to --cc
smtpc_bcc
- analogous to --bcc
smtpc_reply_to
- analogous to --reply-to
smtpc_body_type
- analogous to --body-type
, but it's the final content-type of messagesmtpc_raw_body
- True if --raw-body
was used, and False if notsmtpc_predefined_profile
- almost all informations from profile, if specified (see: --profile
)smtpc_predefined_message
- almost all informations from message, if specified (see: --message
)You can read more about Jinja2 capabilities on Jinja2 homepage.
I'm backend developer, not a frontend guy nor designer... And project requires some logo and/or icon. If you're able to prepare some for this project, do not hesitate to mail me :)
Also, if you have an idea how to enhance SMTPc
, please fill the ticket.
Every idea, every feature request can help you, me and others!
If you like or dislike this software, please do not hesitate to tell me about it via email (marcin@urzenia.net).
If you find a bug or have an idea to enhance this tool, please use GitHub's issues.
smtpc_
profiles
and messages
is list
now (calling without
subcommand will display list of profiles/messages instead of help)--body
or --body=-
is usedp
- for profiles
, s
for send
, m
for messages
send
and profiles
commands: ask for password if --password
param
was used with no argument--message-interactive
param for send
command. Allows editing of
raw message body just before sendingUser-Agent
header and when --version
is called to smtpc.net
--template-field
and --template-field-json
params for send
command,
allows to replace some {{ fields }}
in email body or subject with specified
values. Or you can also use Jinja2 if
module is installedsmtpc profiles delete
, smtpc messages delete
- self explanatory I guess :)--ssl
and --tls
when sending message using profile--dry-run
option--reply-to
optionUser-Agent
header to generated messagesprofile
-> profiles
messages
for managing of saved email messages--version
FAQs
Unknown package
We found that smtpc demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.