# connect to your Email-Server and send Hello Message (ehlo) smtpObj = smtplib.SMTP('smtp.example.com', 587) smtpObj.ehlo() # start TLS encryption for security smtpObj.starttls() # login to the Email-Server with your own username/password smtpObj.login('[email protected]', 'PASSWORD') # send Email from Bob to Alice. Email-Headers are text-fields on separate lines. # the Email-Body is separated by an empty line from the header. smtpObj.sendmail('[email protected]', '[email protected]', 'Subject:Just a Test\nDate:20171208\nFrom:[email protected]\n\nThis is a test-mail. Ignore!') # disconnect from Mailserver smtpObj.quit()