Pythonでメールを扱う方法です。
# -*- coding: utf-8 -*- # 定義 import smtplib from email.mime.text import MIMEText from email.header import Header from email.utils import formatdate # サーバ ip = 'XXXXXX' port = 'XXXX' # 宛先等 from = 'from@xxx.xx.jp' to = 'to@xxx.xx.jp' # メールの文字コード charset = 'ISO-2022-JP' #charset = 'utf-8' #charset = 'us-ascii' # 件名 subject = 'XXX' # 本文 text = 'XXX' msg = MIMEText(text, 'plain', charset) msg['Subject'] = Header(subject, charset) msg['From'] = from msg['To'] = to msg['Date'] = formatdate(localtime=True) smtp = smtplib.SMTP(ip, port) smtp.sendmail(from, to, msg.as_string()) smtp.close()