Thread
#prefect-community
    Jessica Smith

    Jessica Smith

    11 months ago
    Wanted to ask this here before raising an issue on Github. Is there a reason the EmailTask cannot send emails via an internal SMTP server, without SSL?
    Kevin Kho

    Kevin Kho

    11 months ago
    Hey @Jessica Smith, sorry not too familiar with this myself but what is the alternative to SSL?
    Jessica Smith

    Jessica Smith

    11 months ago
    No security - but it's sent on the internal network so it doesn't go over the internet. Here's a very simple implementation that I'm using
    import smtplib
    from email.message import EmailMessage
    def send_email(subject, body, from_addr=None,to_addr=None):
        
    smtp_obj = smtplib.SMTP("internal_smtp_server")
        
    msg = EmailMessage()
        
    msg.set_content(body)
        
    msg['Subject'] = subject
        
    msg['From'] = from_addr
        
    msg['To'] = to_addr
        
    msg_t = <http://msg.as|msg.as>_string()
        
    smtp_obj.sendmail(msg['From'], msg['To'].split(';'), msg_t)
    Kevin Kho

    Kevin Kho

    11 months ago
    Ah I see what you mean. I would say in general 80+% of our task library is community contributed, so take them more as suggestions. I do think this makes sense though and we’d gladly accept a PR to send emails with no security. It looks like it’ll be a lot easier for you to just wrap this as a task.
    Jessica Smith

    Jessica Smith

    11 months ago
    yeah, that's what i'm doing currently, but doing that and sharing it between different scripts means i have to manage the imports differently. i'll look at doing a PR for it if I have time. thanks Kevin