<@ULVA73B9P> after upgraded to version 3.0.3, i un...
# marvin-in-the-wild
s
@Marvin after upgraded to version 3.0.3, i unable add automation send a notification from my email block
m
It seems you are experiencing issues with setting up email notifications using Prefect version 3.0.3. Here are the key points for configuring email notifications and common pitfalls. ### Setting Up Email Notifications 1. Install Prefect Email Package: Ensure you have installed the
prefect-email
package.
Copy code
pip install -U prefect-email
2. Register Email Block Types: Register the necessary block types to make them available for use.
Copy code
python
   prefect block register -m prefect_email
3. Save Email Server Credentials: Save your email credentials (e.g., Gmail) to a block.
Copy code
python
   from prefect_email import EmailServerCredentials

   credentials = EmailServerCredentials(
       username="<mailto:your-email@example.com|your-email@example.com>",
       password="your-app-password",  # Must be an app password
   )
   credentials.save("email-server-credentials")
4. Send Emails Using a Flow: Use the credentials block to send emails.
Copy code
python
   from prefect import flow
   from prefect_email import EmailServerCredentials, email_send_message

   @flow
   def example_email_send_message_flow(email_addresses):
       email_server_credentials = EmailServerCredentials.load("email-server-credentials")
       email_send_message(
           email_server_credentials=email_server_credentials,
           subject="Test Email",
           msg="This is a test email from Prefect",
           email_to=email_addresses,
       )

   example_email_send_message_flow(["<mailto:recipient@example.com|recipient@example.com>"])
### Common Issues and Troubleshooting - ModuleNotFoundError: No module named
email.utils
: This error usually indicates a misconfiguration or conflict with packages. Ensure there is no file named
email.py
in your project directory, as it can shadow the built-in email module. - SMTP Authentication Errors: If you encounter authentication errors, ensure you are using an application-specific password, especially for Gmail. ### Useful Links - Prefect Email Integration Docs (3.x) - GitHub Issue related to `ModuleNotFoundError`: No module named 'email.utils' Please follow these steps and double-check your environment setup. If the problem persists, please let me know, and we can dive deeper into specific issues.