ekutner/kopia-mon

Multiple recipients in config.yaml

Closed this issue · 4 comments

I'm having trouble creating an array with multiple recipients in the to: line in config.yaml. I tried several methods on how YAML likes arrays, but no luck. How do I represent the array in config.yaml? Thanks.

the easiest way, without worrying about indentation, is to: [ "address1", "address2" ]

Thank you. But when I use to: [ "uuu@vvv.www", "xxx@yyy.zzz" ] it gives me:

~/kopia-mon# python3 kopia-mon.py 
Traceback (most recent call last):
  File "/root/kopia-mon/kopia-mon.py", line 56, in <module>
    em.send(html, error_count>0)
  File "/root/kopia-mon/emailutil.py", line 34, in send
    server.sendmail(msg['From'], msg['To'], msg.as_string(), )
  File "/usr/lib/python3.9/email/message.py", line 158, in as_string
    g.flatten(self, unixfrom=unixfrom)
  File "/usr/lib/python3.9/email/generator.py", line 116, in flatten
    self._write(msg)
  File "/usr/lib/python3.9/email/generator.py", line 199, in _write
    self._write_headers(msg)
  File "/usr/lib/python3.9/email/generator.py", line 226, in _write_headers
    self.write(self.policy.fold(h, v))
  File "/usr/lib/python3.9/email/_policybase.py", line 326, in fold
    return self._fold(name, value, sanitize=True)
  File "/usr/lib/python3.9/email/_policybase.py", line 369, in _fold
    parts.append(h.encode(linesep=self.linesep, maxlinelen=maxlinelen))
AttributeError: 'list' object has no attribute 'encode'
~/kopia-mon# 

Using one recipient in the array to: [ "xxx@yyy.zzz" ] gives the same error. When reverting back to one recipient without the array it works as expected, just using one recipient. Thanks in advance.

Please pull the latest updates, it should be fixed now.

I can confirm. Sending to multiple recipients is now working correctly.