Search code examples
pythonsmtplib

Adding multiple e-mail addresses to config.json


I'm working on someone else's script and need to update the config.json file to contain multiple e-mail addresses. The e-mail module uses smtplib and the 'to_address' is contained in config.json. It works fine with the only a single address, but I'm stuck on how to make it use multiple ones.

config.json entry that works:

"smtp_to_address": "Joe.Blow@Kokomo.ca"

How I thought it should look:

"smtp_to_address": "Joe.Blow@Kokomo.ca, hotmale@hotmail.com, favourable@outlook.com"

I also tried:

"smtp_to_address": ["Joe.Blow@Kokomo.ca, hotmaile@hotmail.com, favourable@outlook.com"]

It only sends to Joe Blow.


Solution

  • I needed to put quotes around each e-mail address as illustrated below:

    "smtp_to_address": ["Joe.Blow@Kokomo.ca", "hotmaile@hotmail.com", "favourable@outlook.com"]