Email and text notification program
Project description
sendpy
Overview
sendpy is a command line email and text notification program that makes use of external and local SMTP servers to send messages.
However, sendpy is much more than that. sendpy is rich in features and use cases. For example, using this program, one may:
- Attach files to a message
- Send Unicode characters/emojis in the Subject or Body of a message
- Digitally sign a message with S/MIME or PGP encryption
- Send a notification when a long running process (LRP) has finished execution
- Delay the sending of an email until a specific time
- And more!
Help for sending an e-mail and understanding this program can be found using sendpy --help
, sendpy --examples
, sendpy --smtp-servers
, and sendpy --gateways
.
Quick Start in 4 Easy Steps
To expedite the ability for users to send a message, here is a quick setup and example:
-
Install:
pip3 install sendpy
orpython3 -m pip install sendpy
. -
Set the default configuration file to store repetitive commands (e.g., username, password):
sendpy --config
. -
If necessary, create an App Password or enable less secure app access with your external email service (ex. Gmail).
-
Send a basic message:
sendpy --subject "Employment Opportunity" --to "connellyd2050@gmail.com" --message "Hello,\n\n When is a good time to talk about an open position we have for you?"
.
Dependencies
The following libraries are used in this program:
- OpenSSL
- GNU Privacy Guard (GPG)
OpenSSL and GPG, are installed on most Linux
distributions by default and may easily be installed on Windows and macOS.
However, so long as a user is not signing emails (the --passphrase
and --certificate
flags),
one may use this program without any additional installations on Windows or
macOS.
Help
$ sendpy --help
usage: [-h] [-v] [-s SUBJECT] [-m MESSAGE] [--message-file MESSAGE_FILE] [-a ATTACHMENTS] [-t TOEMAILS] [-c CCEMAILS] [-b BCCEMAILS] [-f FROMEMAIL] [-S SMTP] [--tls] [--starttls] [-u USERNAME]
[-p PASSWORD] [-P {5 Lowest),4 (Low),Normal,2 (High),1 (Highest}] [-r] [-C CERT] [-k PASSPHRASE] [-z ZIPFILE] [-l] [-U] [-T TIME] [-d] [-n NOTIFY] [-V] [--config] [--examples]
[--smtp-servers] [--gateways]
One or more To, CC or BCC e-mail addresses are required. Send text messages by using the mobile providers e-mail to SMS or MMS gateway (see the --gateways option). See examples with the --examples
option.
optional arguments:
-h, --help show this help message and exit
-v, --version show program's version number and exit
-s SUBJECT, --subject SUBJECT
Subject. Escape sequences are expanded. Supports Unicode characters.
-m MESSAGE, --message MESSAGE
Message body. Escape sequences are expanded. Supports Unicode characters.
--message-file MESSAGE_FILE
Message body from a file or standard input if the filename is '-'.
-a ATTACHMENTS, --attachment ATTACHMENTS
Attachment filename. Use multiple times for multiple attachments. Supports Unicode characters in filename.
-t TOEMAILS, --to TOEMAILS
To e-mail address. Use multiple times for multiple To e-mail addresses.
-c CCEMAILS, --cc CCEMAILS
CC e-mail address. Use multiple times for multiple CC e-mail addresses.
-b BCCEMAILS, --bcc BCCEMAILS
BCC e-mail address. Use multiple times for multiple BCC e-mail addresses.
-f FROMEMAIL, --from FROMEMAIL
From e-mail address
-S SMTP, --smtp SMTP SMTP server. Optionally include a port with the "hostname:port" syntax. Defaults to port 465 with --ssl/--tls and port 25 otherwise. Use "localhost" if running a mail
server on this device.
--tls Use a secure connection with SSL/TLS (Secure Socket Layer/Transport Layer Security)
--starttls Upgrade to a secure connection with StartTLS
-u USERNAME, --username USERNAME
SMTP server username
-p PASSWORD, --password PASSWORD
SMTP server password. For security, use the --config option instead for it to prompt you for the password and then store in the configuration file.
-P {5 (Lowest),4 (Low),Normal,2 (High),1 (Highest)}, --priority {5 (Lowest),4 (Low),Normal,2 (High),1 (Highest)}
Priority. Supported priorities: "5 (Lowest)", "4 (Low)", "Normal", "2 (High)" and "1 (Highest)"
-r, --receipt Request Return Receipt
-C CERT, --certificate CERT
S/MIME Certificate filename for digitally signing the e-mails. It will ask you for the password the first time you run the script with this option.
-k PASSPHRASE, --passphrase PASSPHRASE
PGP secret key passphrase for digitally signing the e-mails with PGP/MIME. For security, use 'config' for it to prompt you for the passphrase and then store in the
configuration file.
-z ZIPFILE, --zip ZIPFILE
Compress attachment(s) with zip
-l, --language Set Content-Language. Uses value of LANG environment variable on Linux.
-U, --sanitize-date Uses Coordinated Universal Time (UTC) and rounds date down to whole minute.
-T TIME, --time TIME Time to delay sending of the e-mail
-d, --dry-run Dry run, do not send the e-mail
-n NOTIFY, --notify NOTIFY
Run provided command and then send an e-mail with resulting output and exit code.
-V, --verbose Verbose, show the client-server communication
--config Store the --from, --smtp, --tls, --starttls, --username and --password option values in a '.sendpy.ini' configuration file as defaults for future use. It will prompt for
any values that are not provided.
--examples Show example usages of this script and exit
--smtp-servers Show a list of the SMTP servers for common e-mail services, then exit
--gateways Show a list the of SMS and MMS Gateways for common mobile providers in the United States and Canada, then exit
Examples
$ sendpy --examples
Sendpy Examples (assumes config file is used):
Send e-mail
$ sendpy --subject "Example" --to "User <user@example.com>"
Send e-mail with message
$ sendpy --subject "Example" --message 'This is an example!' --to "User <user@example.com>"
Send e-mail with message and single attachment
$ sendpy --subject "Example" --message 'This is an example!' --attachment example.txt --to "User <user@example.com>"
Send e-mail with message and multiple attachments
$ sendpy --subject "Example" --message 'This is an example!' --attachment example1.txt --attachment example2.txt --to "User <user@example.com>"
Send e-mail to a CC address
$ sendpy --subject "Example" --to "User 1 <user1@example.com>" --cc "User 2 <user2@example.com>"
Set config file with external SMTP server
$ sendpy --from "Example <example@example.com>" --smtp "mail.example.com" --tls --username "example" --config
Send high priority e-mail
$ sendpy --subject "Example" --priority "1 (Highest)" --to "User <user@example.com>"
Send e-mail digitally signed with an S/MIME Certificate
$ sendpy --subject "Example" --certificate "cert.p12" --to "User <user@example.com>"
Send e-mail digitally signed with PGP/MIME
$ sendpy --subject "Example" --passphrase "config" --to "User <user@example.com>"
Donate
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file sendpy-1.0.2.tar.gz
.
File metadata
- Download URL: sendpy-1.0.2.tar.gz
- Upload date:
- Size: 29.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a1f972f381a7b6758667cf7779c15455cbfd0108dc8599aa16f86eb10b6a6ab |
|
MD5 | 9a0b72070f91059af533b53316d649bb |
|
BLAKE2b-256 | c48d6ad9c62270ae38cfff04c227e66411bf1d4dae4bace5efc57d40fe53ab43 |
File details
Details for the file sendpy-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: sendpy-1.0.2-py3-none-any.whl
- Upload date:
- Size: 29.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b41b7e0d6f1f403db0f636f456949d903d70ef6c6385260a840d7efa3ecf423 |
|
MD5 | f049b7b865d22e6628b9655704423a00 |
|
BLAKE2b-256 | 750171a09164efb56214d3268ac053b4e9cdde50ce085ec19958833db4d968db |