Simple script for sending emails
Project description
headnode notifier
Simple script for sending emails.
Usage examples
usage: headnode_notifier [address] [OPTION]
Simple script for email notifications. Uses gmail by default.
positional arguments:
Recipient address
optional arguments:
-h, --help show this help message and exit
-v, --version show program's version number and exit
--subject Message subject
--body Message body
--attach Attachment
--serv-addr Server address. Default <smtp.gmail.com>
--port Server's port. Default: <587>
--from-addr Account address.
--password-file Read password from exeternal file. Prevents hard-coding
password anywhere in this script. IMPORTANT! Password is
stored as plain text! Do NOT use with your personal
account!
Let's assume you are using default account and you have password file in a proper place
You can specify the message subject, content and attach a file.
headnode_notifier.py recipient@domain.com --subject 'Important message' --body 'Hello there!' --attach ./some/file.zip
You can also send just blank message, only recipient@domain.com
is truly obligatory if using default values for the rest.
You can specify server, port and else if you wish with --serv-addr smpt.provider.com --port 42 --from-addr my.address@provider.com
Config handling
If an option is not specified in the CLI, it is read from the headnode_notifier.config file. It is meant to facilitate the usage by setting default values for:
- Server address.
- Port.
- Mailbox address
- /path/to/password_file
- Config content:
[server]
address = smtp.gmail.com
port = 587
[mailbox]
address =
password_file =
-
Config location: $HOME
-
Config name:
.headnode_notifier.config
Password handling
In order to avoid storing the password anywhere in the script, it is read from file. You can specify the path using --password-file /path/to/file
or in the config file. Remember that the password file is plain text so use the script with caution.
Using gmail
Remember to allow less secure apps to connect if using gmail. You can set it on google account security page
Project details
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 headnode_notifier-1.5.4.tar.gz
.
File metadata
- Download URL: headnode_notifier-1.5.4.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 75b8de4d65dc4d3b9abf024a866f4f1345d03c9219523184782718f68ddb2f78 |
|
MD5 | 41a2b82f5c662125128c111b63cb997c |
|
BLAKE2b-256 | db89a75567db61ca18d0d2ef15606a72b7239fadbf81c5b70176e00d5f7b123d |
File details
Details for the file headnode_notifier-1.5.4-py3-none-any.whl
.
File metadata
- Download URL: headnode_notifier-1.5.4-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea4f3b927e00602f6d1db57dc95a78d2e702af9a5d643ecff56108bc50035d4e |
|
MD5 | 051a1e5e0e017c408a68af662145785e |
|
BLAKE2b-256 | 1bafc31b77303b3bf5988f42dd90de2d12eaba539954748bdacd1aceac5e0741 |