- name: send an email
mail:
host: email-smtp.eu-west-1.amazonaws.com
port: 587
username: xxx
password: xxx
from: xxx
to: "{{ item.firstname }} {{ item.lastname }} <{{ item.email }}>"
subject: configuration files
body: "{{ lookup('template', 'email_body.j2') }}"
secure: starttls
attach: "/mnt/data/users_config/{{ item.firstname }}_{{ item.lastname }}.txt /mnt/data/users_config/{{ item.firstname }}_{{ item.lastname }}.pdf"
loop: "{{ users }}"
I tried to add quotes almost everywhere but either it tries to load a single file (not splitting by space) resulting in a [Errno 2] No such file or directory or it ends up with an invalid yaml if I don't have the required quotes.
Any idea ?
Thank you !
A space-separated list of pathnames of files to attach to the message.