Python で、メール送信

SMTP認証無し[シンプル送信]

(認証なしサンプル)

import smtplib
from email.mime.text import MIMEText
 
# Send Config
to_email = "info@heroheo.co.jp"
from_email = "dokoka@aaaa.co.jp"
smtp_server = '172.16.1.67'
smtp_port = 25
 
# MIMEText Create
message = "Mail Message"
msg = MIMEText(message, "html")
msg["Subject"] = "Mail subject"
msg["To"] = to_email
msg["From"] = from_email
 
# SMTP Server Name
server = smtplib.SMTP(smtp_server, smtp_port)

# Email Send Execute
server.send_message(msg)

# Email Close
server.quit()
タイトルとURLをコピーしました