User Tools

Site Tools


snippets:python

Python snippets

Send SMTP mail

import smtplib,ssl
from email.utils import formatdate

server = smtplib.SMTP("192.168.100.11",25) 
#server = smtplib.SMTP_SSL("192.168.100.11",465) # SSL
#server = smtplib.SMTP_SSL("192.168.100.11",587) # TLS
#server.starttls(context=ssl.create_default_context()) # TLS
#server.login("[email protected]", "bastpword")
server.ehlo()
server.sendmail("[email protected]", "[email protected]", """\
From: YOUR MOM <[email protected]>
To: LOL YOU <[email protected]>
Date: """+formatdate(localtime=True)+"""
Subject: Eyyyyyy!

I like turtles!""")

snippets/python.txt · Last modified: 2020/01/31 17:57 by mathias