-1

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.

Pranav Hosangadi
  • 23,755
  • 7
  • 44
  • 70
kill9all
  • 101
  • 1
  • 8
  • 4
    Have you tried `"smtp_to_address": ["Joe.Blow@Kokomo.ca", "hotmaile@hotmail.com", "favourable@outlook.com"]`? As shown above, `smtp_to_address` is still a list consisting of one comma-separated string. – mipadi Aug 16 '22 at 19:00
  • I was so close... I'm on day 3 of a 100 day python course and now I need to go back to day 2 "Strings and Expressions". – kill9all Aug 16 '22 at 19:11

1 Answers1

0

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"]
kill9all
  • 101
  • 1
  • 8