Hi Folks, Is there an example of sending emails using Sendgrid using prefect? I can send emails via sendgrid API without issues. However, while using it with prefect I am getting a
ForbiddenError: HTTP Error 403: Forbidden
m
Mariia Kerimova
09/07/2021, 3:26 PM
Hello Shyam! I don't see any significant changes on Sendgrid side, would you mind to post a minimal example of your setup (using a Prefect task, redacting Sendgrid api key)?
Mariia Kerimova
09/07/2021, 3:53 PM
This is my simple working example. I installed prefect with sendgrid extra (
pip install "prefect[sendgrid]"
), generated a sendgrid api key and ran this flow
Copy code
from prefect import Flow
from prefect.tasks.sendgrid import SendEmail
sengrid_send_email = SendEmail(
from_email="<mailto:notifications@prefect.io|notifications@prefect.io>",
to_emails="<your@email>",
subject="Test Prefect Sendgrid Task",
html_content="<strong>and easy to do anywhere, even with Python</strong>",
sendgrid_api_key="<>"
)
with Flow("Sendgrid Flow") as flow:
sengrid_send_email()
flow.register(project_name="Examples")
Looks like it's not possible right now. But we always welcome contributors to Prefect tasks library, and adding bcc can be easily achieved, by adding Sendgrid bcchere.
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.