# sending host task info to an email

**URL:** <https://forum.ansible.com/t/sending-host-task-info-to-an-email/33767>\
**Category:** Ansible Project\
**Created:** [September 8, 2020, 10:30pm UTC](https://forum.ansible.com/t/sending-host-task-info-to-an-email/33767 "2020-09-08T22:30:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Angie\_DeRubeis](https://avatars.discourse-cdn.com/v4/letter/a/58956e/32.png) [@Angie\_DeRubeis](https://forum.ansible.com/u/Angie_DeRubeis)\
**Post date:** [September 8, 2020, 10:30pm UTC](https://forum.ansible.com/t/sending-host-task-info-to-an-email/33767/1 "2020-09-08T22:30:10Z")

</div>

Hello,

I have a cisco ios command configured for a group of host and a mail setup to send results but the results mail separately instead in group, as the task does. How do I change it to send one email per playbook?

---

<div class="post-metadata">

**Author:** ![Antony\_Stone](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@Antony\_Stone](https://forum.ansible.com/u/Antony_Stone)\
**Post date:** [September 8, 2020, 10:38pm UTC](https://forum.ansible.com/t/sending-host-task-info-to-an-email/33767/2 "2020-09-08T22:38:46Z")

</div>

It might help us to be able to answer your question if you gave us a bit more  
information such as:

- what is the "command you have configured for the group of host(s)"?

- what is the "mail setup" you're using?

- how have you built this in to the playbook to send an email?

Tell us enough to reproduce your setup and your problem, and we might be able  
to work out how to help you 🙂

Regards,

Antony.

---

<div class="post-metadata">

**Author:** ![Angie\_DeRubeis](https://avatars.discourse-cdn.com/v4/letter/a/58956e/32.png) [@Angie\_DeRubeis](https://forum.ansible.com/u/Angie_DeRubeis)\
**Post date:** [September 8, 2020, 10:55pm UTC](https://forum.ansible.com/t/sending-host-task-info-to-an-email/33767/3 "2020-09-08T22:55:01Z")

</div>

I am getting the output from the task and I am getting a separate email with the task but it is not inserting the hostname.

I would like to see the hostnames and one email per playbook.

This is my playbook

-name: Verify NAC  
host: switches  
connection: local

task:

ios\_command:  
commands: show authentication sessions  
register: output

-name: show authentication sessions  
debug: var=output.stdout[0]

-name: send email  
mail:  
host: [mail.company.com](http://mail.company.com)  
timeout:60
