I try to send mails from python to multiple email-addresses, imported from a .txt file, I\'ve tried differend syntaxes, but nothing would work...
The code:
This question has sort of been answered, but not fully. The issue for me is that "To:" header wants the emails as a string, and the sendmail function wants it in a list structure.
# list of emails
emails = ["banjer@example.com", "slingblade@example.com", "dude@example.com"]
# Use a string for the To: header
msg['To'] = ', '.join( emails )
# Use a list for sendmail function
s.sendmail(from_email, emails, msg.as_string() )