{"id":18084857,"url":"https://github.com/jwodder/daemail","last_synced_at":"2025-04-12T20:10:11.167Z","repository":{"id":62566300,"uuid":"57335258","full_name":"jwodder/daemail","owner":"jwodder","description":"Daemonize a command and e-mail the results","archived":false,"fork":false,"pushed_at":"2025-01-23T14:42:09.000Z","size":273,"stargazers_count":2,"open_issues_count":24,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T20:10:03.926Z","etag":null,"topics":["available-on-pypi","background","daemon","e-mail","email","mail","notifications","output","python","smtp"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jwodder.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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-04-28T21:34:45.000Z","updated_at":"2025-01-23T14:42:10.000Z","dependencies_parsed_at":"2023-09-30T18:33:39.720Z","dependency_job_id":"e4fcef22-fe1a-445c-aa86-5079cb9f0f06","html_url":"https://github.com/jwodder/daemail","commit_stats":{"total_commits":281,"total_committers":2,"mean_commits":140.5,"dds":"0.12811387900355875","last_synced_commit":"7164b470c66c5f870e96db514036d61b5e7e0fae"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwodder%2Fdaemail","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwodder%2Fdaemail/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwodder%2Fdaemail/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwodder%2Fdaemail/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jwodder","download_url":"https://codeload.github.com/jwodder/daemail/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248625493,"owners_count":21135513,"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":["available-on-pypi","background","daemon","e-mail","email","mail","notifications","output","python","smtp"],"created_at":"2024-10-31T15:08:26.729Z","updated_at":"2025-04-12T20:10:11.145Z","avatar_url":"https://github.com/jwodder.png","language":"Python","readme":"|repostatus| |ci-status| |coverage| |pyversions| |license|\n\n.. |repostatus| image:: https://www.repostatus.org/badges/latest/active.svg\n    :target: https://www.repostatus.org/#active\n    :alt: Project Status: Active - The project has reached a stable, usable\n          state and is being actively developed.\n\n.. |ci-status| image:: https://github.com/jwodder/daemail/actions/workflows/test.yml/badge.svg\n    :target: https://github.com/jwodder/daemail/actions/workflows/test.yml\n    :alt: CI Status\n\n.. |coverage| image:: https://codecov.io/gh/jwodder/daemail/branch/master/graph/badge.svg\n    :target: https://codecov.io/gh/jwodder/daemail\n\n.. |pyversions| image:: https://img.shields.io/pypi/pyversions/daemail.svg\n    :target: https://pypi.org/project/daemail\n\n.. |license| image:: https://img.shields.io/github/license/jwodder/daemail.svg?maxAge=2592000\n    :target: https://opensource.org/licenses/MIT\n    :alt: MIT License\n\n`GitHub \u003chttps://github.com/jwodder/daemail\u003e`_\n| `PyPI \u003chttps://pypi.org/project/daemail\u003e`_\n| `Issues \u003chttps://github.com/jwodder/daemail/issues\u003e`_\n| `Changelog \u003chttps://github.com/jwodder/daemail/blob/master/CHANGELOG.md\u003e`_\n\n``daemail`` (pronounced \"DEE-mayl\", like \"e-mail\" but with a D) is a Python\nscript built on top of `python-daemon\n\u003chttps://pypi.org/project/python-daemon\u003e`_ for running a normally-foreground\ncommand in the background and e-mailing its output (by default, the combined\nstdout and stderr) once it's done.\n\n\nInstallation\n============\n\n``daemail`` requires Python 3.8 or higher.  Just use `pip\n\u003chttps://pip.pypa.io\u003e`_ for Python 3 (You have pip, right?) to install\n``daemail`` and its dependencies::\n\n    python3 -m pip install daemail\n\n\nUsage\n=====\n\n::\n\n    daemail [\u003coptions\u003e] \u003ccommand\u003e [\u003carg\u003e ...]\n\n``daemail`` runs ``command`` with the given arguments in the background and\nsends an e-mail once the command finishes.  The sending of the e-mail is\nperformed by the outgoing_ library, and thus an `outgoing configuration file`__\nmust be created with settings for sending e-mail before ``daemail`` can be\nused.\n\n.. _outgoing: https://github.com/jwodder/outgoing\n__ https://outgoing.readthedocs.io/en/latest/configuration.html\n\nOptions\n-------\n\n-c FILE, --config FILE  Read sending configuration for the ``outgoing`` library\n                        from ``FILE``; defaults to ``outgoing``'s default\n                        configuration file\n\n-C DIR, --chdir DIR     Change to ``DIR`` after daemonizing but before running\n                        the command; defaults to the current directory\n\n-D MBOX, --dead-letter MBOX\n                        If an error occurs when trying to send, append the\n                        e-mail (including a description of the error) to the\n                        file ``MBOX``; defaults to ``dead.letter``.  If the\n                        file already exists, it must be a valid mbox file.\n\n-e ENCODING, --encoding ENCODING\n                        Expect the stdout (and stderr, if ``--split`` is not in\n                        effect) of the command to be in the given encoding;\n                        defaults to the preferred encoding returned by Python's\n                        |getpreferredencoding|_.  If decoding fails, the output\n                        will be attached to the e-mail as an\n                        ``application/octet-stream`` file named \"``stdout``\".\n\n                        When ``--mime-type`` or ``--stdout-filename`` is also\n                        given, this option has no effect other than to set the\n                        default value for ``--stderr-encoding``.\n\n-E ENCODING, --stderr-encoding ENCODING\n                        Expect the stderr of the command to be in the given\n                        encoding; defaults to the value specified via\n                        ``--encoding`` or its default.  If decoding fails, the\n                        stderr output will be attached to the e-mail as an\n                        ``application/octet-stream`` file named \"``stderr``\".\n\n                        This option only has an effect when ``--split`` is\n                        given, either implicitly or explicitly.\n\n--foreground, --fg      Run everything in the foreground instead of\n                        daemonizing.  Note that command output will still be\n                        captured rather than displayed.\n\n-f ADDRESS, --from ADDRESS, --from-addr ADDRESS\n                        Set the ``From:`` address of the e-mail.  The address\n                        may be given in either the form\n                        \"``address@example.com``\" or \"``Real Name\n                        \u003caddress@example.com\u003e``.\"  If not specified,\n                        ``daemail`` will not set the ``From:`` header and will\n                        expect the mail command or SMTP server to do it\n                        instead.\n\n-F, --failure-only      Only send an e-mail if the command failed to run or\n                        exited with a nonzero status\n\n-l LOGFILE, --logfile LOGFILE\n                        If an unexpected \u0026 unhandleable fatal error occurs\n                        after daemonization, append a report to ``LOGFILE``;\n                        defaults to ``daemail.log``\n\n                        Such an error is a deficiency in the program; please\n                        report it!\n\n-M MIME-TYPE, --mime-type MIME-TYPE, --mime MIME-TYPE\n                        Attach the standard output of the command to the\n                        e-mail as an inline attachment with the given MIME\n                        type.  The MIME type may include parameters, e.g.,\n                        ``--mime-type \"text/html; charset=utf-16\"``.  If\n                        ``--stdout-filename`` is not also supplied, the\n                        attachment is named \"``stdout``\".  Implies ``--split``.\n\n-n, --nonempty          Do not send an e-mail if the command exited\n                        successfully and both the command's stdout \u0026 stderr\n                        were empty or not captured\n\n--no-stdout             Don't capture the command's stdout; implies ``--split``\n\n--no-stderr             Don't capture the command's stderr; implies ``--split``\n\n-S, --split             Capture the command's stdout and stderr separately\n                        rather than as a single stream\n\n--stdout-filename FILENAME\n                        Attach the standard output of the command to the e-mail\n                        as an inline attachment with the given filename.  If\n                        ``--mime-type`` is not also supplied, the MIME type of\n                        the attachment is deduced from the file extension,\n                        falling back to ``application/octet-stream`` for\n                        unknown extensions.  Implies ``--split``.\n\n-t ADDRESS, --to ADDRESS, --to-addr ADDRESS\n                        Set the recipient of the e-mail.  The address may be\n                        given in either the form \"``address@example.com``\" or\n                        \"``Real Name \u003caddress@example.com\u003e``.\"\n\n                        This option is required.  It may be given multiple\n                        times in order to specify multiple recipients.\n\n-Z, --utc               Show start \u0026 end times in UTC instead of local time\n\n\nCaveats\n=======\n- Input cannot be piped to the command, as standard input is closed when\n  daemonizing.  If you really need to pass data on standard input, run a shell,\n  e.g.::\n\n    daemail bash -c 'command \u003c file'\n\n  or::\n\n    daemail bash -c 'command | other-command'\n\n\n.. |getpreferredencoding| replace:: ``locale.getpreferredencoding``\n.. _getpreferredencoding: https://docs.python.org/3/library/locale.html#locale.getpreferredencoding\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwodder%2Fdaemail","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjwodder%2Fdaemail","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwodder%2Fdaemail/lists"}