Prefect tasks and subflows for interacting with email
Project description
prefect-email
## Welcome!prefect-email
is a collection of prebuilt Prefect tasks that can be used to quickly construct Prefect flows that interacts with email services.
Getting Started
Python setup
Requires an installation of Python 3.7+.
We recommend using a Python virtual environment manager such as pipenv, conda or virtualenv.
These tasks are designed to work with Prefect 2.0. For more information about how to use Prefect, please refer to the Prefect documentation.
Installation
Install prefect-email
with pip
:
pip install prefect-email
Then, register to view the block on Prefect Cloud:
prefect block register -m prefect_email
Note, to use the load
method on Blocks, you must already have a block document saved through code or saved through the UI.
Send an email using Gmail
from prefect import flow
from prefect_email import EmailServerCredentials, email_send_message
@flow
def example_email_send_message_flow():
email_server_credentials = EmailServerCredentials(
username="your_email_address@gmail.com",
password="MUST_be_an_app_password_here!",
)
subject = email_send_message(
email_server_credentials=email_server_credentials,
subject="Example Flow Notification using Gmail",
msg="This proves email_send_message works!",
email_to="someone_awesome@gmail.com",
)
return subject
example_email_send_message_flow()
Please note, many email services, like Gmail, require an App Password to successfully send emails. If you encounter an error similar to smtplib.SMTPAuthenticationError: (535, b'5.7.8 Username and Password not accepted...
, it's likely you are not using an App Password.
Resources
If you encounter any bugs while using prefect-email
, feel free to open an issue in the prefect-email repository.
If you have any questions or issues while using prefect-email
, you can find help in either the Prefect Discourse forum or the Prefect Slack community.
Feel free to ⭐️ or watch prefect-email
for updates too!
Development
If you'd like to install a version of prefect-email
for development, clone the repository and perform an editable install with pip
:
git clone https://github.com/PrefectHQ/prefect-email.git
cd prefect-email/
pip install -e ".[dev]"
# Install linting pre-commit hooks
pre-commit install
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
Hashes for prefect_email-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06fdc29ba2a18af1086a412794641389cabb5433a5c44d694cbe831b80c195b8 |
|
MD5 | ec756c325824a3f7100a9f4b8d52aec3 |
|
BLAKE2b-256 | ab24199088cfa779d1f261c2fa97666dddc86ba9f489d7e2f29c5b2815be977a |