Hi All !

I'm trying to attach multiple file to an email by using the mail module 
<https://docs.ansible.com/ansible/2.4/mail_module.html> but it's not 
working at all because I have parameters in my files' name:

- 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 !

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a5e51ec3-0dc5-408a-925c-7ca43b145ed2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to