###メール送信スクリプトを作成
mail.py
from email.mime.text import MIMEText
import smtplib
# SMTP認証情報
account = "example.com"
password = "XXXXXXXX"
# 送受信先
to_email = "receiver@example.com"
from_email = "sender@example.com"
# MIMEの作成
subject = "テストタイトル"
message = "テスト本文"
msg = MIMEText(message, "html")
msg["Subject"] = subject
msg["To"] = to_email
msg["From"] = from_email
# メール送信処理
server = smtplib.SMTP("example.com", 587)
server.starttls()
server.login(account, password)
server.send_message(msg)
server.quit()
###実行
python mail.py