https://prefect.io logo
Title
y

YD

03/23/2023, 5:55 AM
Email Server Credentials - Gmail I am trying to create Email Server Credentials Block I’ve created a Google App password [Blocks] -> [+] -> [Email Server Credentials] Added the App Password my email as a user name Smtp server : tried “emtp.gmail.com” and with none Smtp type: tried “465", “587” and none none of those work does someone have a working example? thanks
BTW, if I use the standard python package
MIMEText
with “emtp.gmail.com” and “587" it works fine
with the Prefect Block I get the following error
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)
I also tried setting to set the
Smtp Port
to “587”, this did not help as well
The code I am using is:
from prefect_email import EmailServerCredentials, email_send_message
from prefect import flow


@flow
def example_email_send_message_flow():
    email_credentials_block = EmailServerCredentials.load("my_block_name")

    subject = email_send_message(
        email_server_credentials=email_credentials_block,
        subject="Example Flow Notification",
        msg="This proves email_send_message works!",
        email_to="<mailto:some_email@gmail.com|some_email@gmail.com>",
    )
    return subject


example_email_send_message_flow()
The email block does not appear to be functioning. it looks like a simpler and a working solution is just to use python
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart