{"id":19610076,"url":"https://github.com/nfultz/nb2mail","last_synced_at":"2025-04-06T22:12:00.466Z","repository":{"id":43781527,"uuid":"66796468","full_name":"nfultz/nb2mail","owner":"nfultz","description":"Send a notebook as an email","archived":false,"fork":false,"pushed_at":"2024-01-06T17:40:48.000Z","size":49,"stargazers_count":138,"open_issues_count":2,"forks_count":17,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-05-01T13:50:51.539Z","etag":null,"topics":["jupyter-notebook","post-processor","smtp"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nfultz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-08-28T23:42:48.000Z","updated_at":"2024-01-17T06:46:26.000Z","dependencies_parsed_at":"2024-01-06T18:45:32.631Z","dependency_job_id":null,"html_url":"https://github.com/nfultz/nb2mail","commit_stats":{"total_commits":47,"total_committers":6,"mean_commits":7.833333333333333,"dds":"0.23404255319148937","last_synced_commit":"e791f4cfc40ccf2c0534c53e7ef0ea9e27304699"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfultz%2Fnb2mail","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfultz%2Fnb2mail/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfultz%2Fnb2mail/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfultz%2Fnb2mail/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nfultz","download_url":"https://codeload.github.com/nfultz/nb2mail/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247557770,"owners_count":20958047,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["jupyter-notebook","post-processor","smtp"],"created_at":"2024-11-11T10:26:38.733Z","updated_at":"2025-04-06T22:12:00.443Z","avatar_url":"https://github.com/nfultz.png","language":"Python","readme":"# nb2mail - send a jupyter notebook as an email\n\n[![PyPI version](https://badge.fury.io/py/nb2mail.svg)](https://badge.fury.io/py/nb2mail)\n\nThis repo contains a `jupyter nbconvert` exporter to convert notebooks to multipart MIME, and a postprocessor to\nsend it via smtp.\n\n## Installation\n\n    pip install nb2mail\n\n## Usage\n\n`nb2mail` does not do anything by itself. It provides an export format\n(\"mail\") and postprocessor (\"SendMailPostProcessor\"). Please see the nbconvert\ndocumentation and example configuration for more information.\n\n## Example\n\nTo generate a mail and send it later with another process (eg `sendmail`):\n\n    jupyter nbconvert --execute --to mail notebook.ipynb\n\n### SMTP Example\nTo convert and send a mail via gmail, you can set the environment\nvariables and declare a postprocessor with `--post`:\n\n    export TO=example@example.ex GMAIL_USER=user GMAIL_PASS=\"*****\"\n    jupyter nbconvert --to mail --post=nb2mail.SendMailPostProcessor notebook.ipynb\n\nAlternatively, you can configure the SMTP settings in a config file `config.py`:\n\n    c = get_config()\n    c.NbConvertApp.export_format = 'mail'\n    c.Exporter.preprocessors = 'nbconvert.preprocessors.ExecutePreprocessor'\n    c.NbConvertApp.postprocessor_class = 'nb2mail.SendMailPostProcessor'\n    c.SendMailPostProcessor.recipient = 'example@example.ex'\n    c.SendMailPostProcessor.smtp_user = 'user'\n    c.SendMailPostProcessor.smtp_pass = '*******'\n    c.SendMailPostProcessor.smtp_addr = 'smtp.gmail.com'\n    c.SendMailPostProcessor.smtp_port = 587\n\nand then run:\n\n    jupyter nbconvert --config config.py demo.ipynb\n\n### 3rd party email distributor Example\nInstead of using SMTP to send emails, one can use 3rd party provider.  \nThis is an example for using [mailgun](examples/mailgun.ipynb) as a 3rd party provider\n\n## Configuring Mail Headers\n\nIn the notebook metadata, you can set mail headers by adding a `nb2mail` block:\n\n    \"nb2mail\": {\n    \"attachments\": [\n        \"business_report_attachment.xlsx\"\n    ],\n    \"From\": \"reports@example.com\",\n    \"To\": \"person1@example.com, person2@example.com\",\n    \"Subject\": \"Business Report\"\n    }\n\nYou can specify multiple recipients by seperating them with commas.\n\n## Disabling Pilcrows\n\nSince CSS doesn't render the same in email, you may want to disable the pilcrows after each section.\n\n    c.MailExporter.anchor_link_text = '' # disable pilcrow, requires nbconvert \u003e= 5.2\n\n## Refences\n\n  * PyPI - https://pypi.python.org/pypi/nb2mail\n\n## TODO\n\n  * Prerender Math - no js in email\n  * Prettier templates\n  * Plotly - here is a workaround:\n\n        # py.iplot(fig, filename=‘dcm_ctr_subplots’)\n        # The above line is what you normally use to show your plots in the notebook\n        # You no longer need that and just need the stuff below\n\n        from IPython.display import Image\n\n        py.image.save_as(fig, filename='yahoo_dcm_ctr_subplots.png')\n        Image('yahoo_dcm_ctr_subplots.png')\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnfultz%2Fnb2mail","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnfultz%2Fnb2mail","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnfultz%2Fnb2mail/lists"}