Office365の設定はこちらにある。
PythonにおけるSMTPの利用はこちらにある。
下記はサンプルコード
import smtplib from email.mime.text import MIMEText SMTP_SERVER="smtp.office365.com" SMTP_PORT=25 MAIL_ACCOUNT="PLEASE MODIFY" MAIL_PASS="PLEASE MODIFY" MAIL_SUBJECT="This is Subject" MAIL_BODY="This is Body" def create_message(): msg = MIMEText(MAIL_BODY) msg['Subject'] = MAIL_SUBJECT msg['From'] = MAIL_ACCOUNT msg['To'] = MAIL_ACCOUNT return msg if __name__ == '__main__': smtp = smtplib.SMTP(SMTP_SERVER,SMTP_PORT) smtp.connect(SMTP_SERVER) smtp.ehlo() smtp.starttls() smtp.ehlo() smtp.login(MAIL_ACCOUNT, MAIL_PASS) msg = create_message() smtp.sendmail(MAIL_ACCOUNT, MAIL_ACCOUNT, msg.as_string()) smtp.quit()