Last active
October 12, 2017 14:01
-
-
Save kurozumi/75eda3333d0d8158d3fa0c0817101dee to your computer and use it in GitHub Desktop.
【Python】Amazon Dashボタンでメール送信する方法
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/python3 | |
import smtplib | |
from email.mime.text import MIMEText | |
#送信元メールアドレスを指定 | |
from_address = "" | |
#送信先メールアドレスを指定 | |
to_address = "" | |
#SMTPメールサーバーのホスト指定 | |
smtp_server = "" | |
#SMTPサーバーのユーザ名指定 | |
smtp_username = "" | |
#SMTPサーバーのパスワード指定 | |
smtp_password = "" | |
message = "ダッシュボタンが押されました" | |
msg = MIMEText(message) | |
msg["Subject"] = message | |
msg["From"] = from_address | |
msg["To"] = to_address | |
s = smtplib.SMTP(smtp_server, 587) | |
s.login(smtp_username, smtp_password) | |
s.sendmail(from_address, [to_address], msg.as_string()) | |
s.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment