I am trying to send e-mails to a list of contacts, along with a blind copy (BCC) to myself, using Yagmail and Python. I couldn't find any examples in the Yagmail documentation that described how to do this. I know it's possible, but I keep getting an error with my current code.
Can anyone help me resolve this?
Note: This code works until I add "bcc" as a method-parameter.
The Code:
yag = yagmail.SMTP(
user={real_sender:alias_sender}, password="xxxxxx", host='smtp.xxxxxx.com', port='587',
smtp_starttls=True, smtp_ssl=None, smtp_set_debuglevel=0, smtp_skip_login=False,
encoding='utf-8', oauth2_file=None, soft_email_validation=True)
to = all_receivers ### list of contacts 1
bcc = all_receivers_bcc ### list of contacts 2
subject = 'SUBJECT HERE'
contents = 'HTML CONTENT HERE'
yag.send(to, bcc, subject, contents) ### FAILS HERE WHEN THE "bcc" is added
You need to tell python which parameter you are inputting. If you don't, you need to make sure parameters are sent in the right order. Try this: