Skip to content

Instantly share code, notes, and snippets.

@kurozumi
Last active October 12, 2017 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kurozumi/75eda3333d0d8158d3fa0c0817101dee to your computer and use it in GitHub Desktop.
Save kurozumi/75eda3333d0d8158d3fa0c0817101dee to your computer and use it in GitHub Desktop.
【Python】Amazon Dashボタンでメール送信する方法
#! /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