Skip to content Skip to sidebar Skip to footer

Python Smtplib Send_message() Failing, Returning Attributeerror: 'str' Object Has No Attribute 'get_all'

I'm working on an project where I have to use the smtplib and email modules in Python 3.4 to send an email. I'm able to create the email itself and I'm able to connect to the serv

Solution 1:

The signature for SMTP.send_message is not the same as SMTP.sendmail. So try:

    server.send_message(msg, fromaddr, toaddrs)

EDIT:

You also need to add the To: headers separately, rather than as a list:

for item in input("To: ").split():
        msg['To'] = item

Post a Comment for "Python Smtplib Send_message() Failing, Returning Attributeerror: 'str' Object Has No Attribute 'get_all'"