Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/env python
- # -*- coding: utf-8 -*-
- import smtplib
- from email.mime.text import MIMEText
- def sendGmail(to, sub, body):
- username = "送信アドレス"
- msg = MIMEText(body)
- msg['Subject'] = sub
- msg['From'] = username
- msg['To'] = to
- smtp = smtplib.SMTP()
- smtp.connect()
- smtp.sendmail(username, to, msg.as_string())
- smtp.close()
- if __name__ == '__main__':
- to = '宛先'
- sub = 'Python smtplib'
- body = 'Hello, Python'
- sendGmail(to, sub, body)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement