小编Hum*_*mer的帖子

AttributeError:“Series”对象在发送电子邮件时没有属性“split”错误

我该如何解决以下错误。测试邮件中用分号分隔的消息如下?理想情况下,我应该从测试中的相应电子邮件发送电子邮件。

测试

SENDFROM        Test 
xx@gmail.com  xxxx@vvv.com;yyy@gggfg.com;tiitioo@ggg.com
yy@xxx.com     ggg@vvv.com;yyy@gggfg.com;vvv@ggg.com
Run Code Online (Sandbox Code Playgroud)
AttributeError: 'Series' object has no attribute 'split'
Run Code Online (Sandbox Code Playgroud)

我的代码如下:

import smtplib, ssl
from email.message import EmailMessage
import getpass
email_pass = getpass.getpass() #Office 365 password 
# email_pass = input() #Office 365 password 
context=ssl.create_default_context()
for idx, row in test.iterrows():
    
    emails = test['Test']
    sender_list  = test["SENDFROM"]
    
    smtp_ssl_host = 'smtp.office365.com'
    smtp_ssl_port = 587
    email_login = "xx@xx.com"
    email_from = sender_list
    email_to = emails
    msg2 = MIMEMultipart()
    msg2['Subject'] = "xxx"
    msg2['From'] = sender_list

    msg2['To'] = ", ".join(email_to.split(";"))
    msg2['X-Priority'] = …
Run Code Online (Sandbox Code Playgroud)

python smtp pandas

3
推荐指数
1
解决办法
6万
查看次数

标签 统计

pandas ×1

python ×1

smtp ×1