Utility to send an email to multiple addresses.
Project description
wmul_emailer
Utility to send an email to multiple addresses. Primarily intended for cli applications. The various fields such as server host, username, etc. are entered at the command line, used to construct a wmul_emailer.EmailSender object, and that object is passed into the main part of the script. The main part of the script can use it as needed to report errors or results without having to worry about the e-mail details.
A cli is provided for testing purposes.
class EmailSender(server_host, port, user_name, password, from_email_address=None, destination_email_addresses=None)
server_host The hostname or ip address of the smtp server.
port The port number on which the smtp server resides.
user_name The username to authenticate with the smtp server.
password The password to authenticate with the smtp server.
from_email_address=None The 'from' e-mail address.
destination_email_addresses=None The e-mail address to which the results should be sent. Must be a list or tuple for multiple addresses, or a str for a single address.
send_email(self, email_body, email_subject, from_email_address=None, destination_email_addresses=None)
email_body The body of the e-mail to be sent.
email_subject The subject line of the e-mail to be sent.
from_email_address=None The 'from' e-mail address, if provided here. If a from_email_address is not included when calling this method, the one provided to the constructor will be used.
destination_email_addresses=None The e-mail address to which the results should be sent, if provided here. If destination_email_addresses are not included when calling this method, the ones provided to the constructor will be used. Must be a list or tuple for multiple addresses, or a str for a single address.
Raises ValueError if either destination_email_addresses or from_email_address are omitted from both the constructor and the call to send_email.
Command-Line Interface
A cli is provided to test that the credentials are functional and that the system can send e-mails.
send_test_email --email destination@example.com --server smtp.example.com --port 25 --username myusername --password mypassword --from_address source@example.com
If everything works, then destination@example.com will receive an e-mail from source@example.com with the subject Test e-mail from wmul_emailer and body This is the test e-mail from wmul_emailer.py. If you are reading this, the software is configured correctly.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wmul_emailer-0.6.0.tar.gz.
File metadata
- Download URL: wmul_emailer-0.6.0.tar.gz
- Upload date:
- Size: 19.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.28.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c9a447e59c8386f30ad4b6c74b3bee81ea414c0b3943314188b248065d386a9
|
|
| MD5 |
68c2e8189b226dabc9639a758db05d15
|
|
| BLAKE2b-256 |
d78c2775164c801c6b3b3ffeb9d4938dc3ac3ff65788a6a9767bdcca94d6c841
|
File details
Details for the file wmul_emailer-0.6.0-py3-none-any.whl.
File metadata
- Download URL: wmul_emailer-0.6.0-py3-none-any.whl
- Upload date:
- Size: 17.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.28.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c3f801b30f2f6d1c40d4a37a492039a569d639f1f24431a5075fcd9025d48ad6
|
|
| MD5 |
8204b8be97bbd38d3d879f573c8f685d
|
|
| BLAKE2b-256 |
0e978c268f9b54fe218eb0cf3a1950b7e3c29a10e0f3fd43af37ddde8ad60795
|