Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import smtplib
- import email.utils
- from email.mime.text import MIMEText
- # Create the message
- msg = MIMEText('This is the body of the message.')
- msg['To'] = email.utils.formataddr(('Recipient',
- 'recipient@example.com'))
- msg['From'] = email.utils.formataddr(('Author',
- 'author@example.com'))
- msg['Subject'] = 'Simple test message'
- server = smtplib.SMTP('mail')
- server.set_debuglevel(True) # show communication with the server
- try:
- server.sendmail('author@example.com',
- ['recipient@example.com'],
- msg.as_string())
- finally:
- server.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement