# How to Send Jupyter Notebook Cell Output via Email or MS Teams?

**URL:** https://discourse.jupyter.org/t/how-to-send-jupyter-notebook-cell-output-via-email-or-ms-teams/30012
**Category:** Zero to JupyterHub on Kubernetes
**Tags:** community, jupyterlab, jupyterhub, how-to, help-wanted
**Created:** [November 12, 2024, 9:47am UTC](https://discourse.jupyter.org/t/how-to-send-jupyter-notebook-cell-output-via-email-or-ms-teams/30012 "2024-11-12T09:47:42Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Pali\_Manohar](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/pali_manohar/32/15130_2.png) [@Pali\_Manohar](https://discourse.jupyter.org/u/Pali_Manohar)
#### Post date: [November 12, 2024, 9:47am UTC](https://discourse.jupyter.org/t/how-to-send-jupyter-notebook-cell-output-via-email-or-ms-teams/30012/1 "2024-11-12T09:47:42Z")

</div>

I have a use case where, whenever an issue occurs, I want to execute a specific Jupyter notebook cell. After execution, I need the interactive output of the cell to be automatically sent to someone via email or MS Teams.

Could anyone advise on how to achieve this in JupyterHub? Is there a way to capture the output of a cell and send it programmatically to a recipient via email or Teams chat?

Thank you for your help!

---

<div class="post-metadata">

### Author: ![manics](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/manics/32/85_2.png) [@manics](https://discourse.jupyter.org/u/manics)
#### Post date: [November 12, 2024, 1:56pm UTC](https://discourse.jupyter.org/t/how-to-send-jupyter-notebook-cell-output-via-email-or-ms-teams/30012/2 "2024-11-12T13:56:12Z")

</div>

You could write a custom JupyterLab plugin to capture the cell output:

> [@How to get output model for a given cell in a JupyterLab extension?](https://discourse.jupyter.org/t/how-to-get-output-model-for-a-given-cell-in-a-jupyterlab-extension/11342):
>
> I am able to access a cell model and its corresponding widget. How can I get the corresponding output model? I would like to know the output expression (“b”) and its corresponding value (“3”). (My aim is to use this information for building a DAG of the “simple” cells, having a single named output.) [image] As a workaround, I could get the output value “3” from the div element of the widget dom e.g. with let div = cellWidget.outputArea.node.children[0] extractOutputValueFromDiv(div) However…

and send it using an MSTeams or email API.

Though it’d be a lot easier to make the API call in a notebook cell instead of trying to capture the output.
