Senden Sie E-Mail an mehrere CC und mehrere Empfänger gleichzeitig mit Python an EmpfängerPython

Python-Programme
Anonymous
 Senden Sie E-Mail an mehrere CC und mehrere Empfänger gleichzeitig mit Python an Empfänger

Post by Anonymous »

Tried with only multiple to and multiple cc individually, which works fine but when i try both i get an error:

File


"path\Continuum\anaconda2\envs\mypython\lib\smtplib.py",
line 870, in sendmail senders [jeder] = (code, bzw.) TypeError:
Nicht -Abweichbarer Typ: 'List' "< /p>
< /blockquote>

Code: < /p>

Code: Select all

from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
from email.mime.application import MIMEApplication

strFrom = 'fasdf@dfs.com'

cc='abc.xyz@dfa.com, sdf.xciv@lfk.com'

to='sadf@sdfa.com,123.lfadf@fa.com'

msg = MIMEMultipart('related')
msg['Subject'] = 'Subject'
msg['From'] = strFrom
msg['To'] =to
msg['Cc']=cc

#msg['Bcc']= strBcc

msg.preamble = 'This is a multi-part message in MIME format.'

msgAlternative = MIMEMultipart('alternative')
msg.attach(msgAlternative)

msgText = MIMEText('This is the alternative plain text message.')
msgAlternative.attach(msgText)

msgText = MIMEText('''

Hello

 '''.format(**locals()), 'html')
msgAlternative.attach(msgText)

import smtplib
smtp = smtplib.SMTP()
smtp.connect('smtp address')
smtp.ehlo()
smtp.sendmail(strFrom, to, msg.as_string())
smtp.quit()

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post