提问人:Selim MEHDI 提问时间:10/23/2023 最后编辑:Selim MEHDI 更新时间:10/23/2023 访问量:33
我的 python 脚本自动发送电子邮件有问题
I have a problem with my python script that sends emails automatically
问:
import smtplib
from email.message import EmailMessage
# Sender's email credentials
sender_email = "[email protected]"
password = "xxxxxx"
# List of recipient emails and sender names
recipients = {
"[email protected]": "First Customer"
}
# Create a common message for all recipients
message = "Hello world!"
subject = "DEMO"
# Loop through recipients and send emails
for recipient_email, sender_name in recipients.items():
msg = EmailMessage()
msg.set_content(message)
msg['Subject'] = subject
msg['From'] = f"{sender_name} <{sender_email}>"
msg['To'] = recipient_email
with smtplib.SMTP_SSL('mail.webservermail.us', 465) as smtp:
smtp.login(sender_email, password)
smtp.send_message(msg)
问题仅出在outlook/hotmail上。 即使没有删除或打开它,电子邮件也只有第一次进入垃圾邮件。
答: 暂无答案
评论