Package: daemail
GitHub|PyPI|Issues|Changelogdaemail(pronounced “DEE-mayl”, like “e-mail” but with a D) is a Python
script built on top ofpython-daemonfor running a normally-foreground
command in the background and e-mailing its output (by default, the combined
stdout and stderr) once it’s done.Installationdaemailrequires Python 3.6 or higher.  Just usepipfor Python 3 (You have pip, right?) to installdaemailand its dependencies:python3 -m pip install daemailUsagedaemail [<options>] <command> [<arg> ...]daemailrunscommandwith the given arguments in the background and
sends an e-mail once the command finishes.  The sending of the e-mail is
performed by theoutgoinglibrary, and thus anoutgoing configuration filemust be created with settings for sending e-mail beforedaemailcan be
used.Options-cFILE,--configFILERead sending configuration for theoutgoinglibrary
fromFILE; defaults tooutgoing’s default
configuration file-CDIR,--chdirDIRChange toDIRafter daemonizing but before running
the command; defaults to the current directory-DMBOX,--dead-letterMBOXIf an error occurs when trying to send, append the
e-mail (including a description of the error) to the
fileMBOX; defaults todead.letter.  If the
file already exists, it must be a valid mbox file.-eENCODING,--encodingENCODINGExpect the stdout (and stderr, if--splitis not in
effect) of the command to be in the given encoding;
defaults to the preferred encoding returned by Python’slocale.getpreferredencoding.  If decoding fails, the output
will be attached to the e-mail as anapplication/octet-streamfile named “stdout”.When--mime-typeor--stdout-filenameis also
given, this option has no effect other than to set the
default value for--stderr-encoding.-EENCODING,--stderr-encodingENCODINGExpect the stderr of the command to be in the given
encoding; defaults to the value specified via--encodingor its default.  If decoding fails, the
stderr output will be attached to the e-mail as anapplication/octet-streamfile named “stderr”.This option only has an effect when--splitis
given, either implicitly or explicitly.--foreground,--fgRun everything in the foreground instead of
daemonizing.  Note that command output will still be
captured rather than displayed.-fADDRESS,--fromADDRESS,--from-addrADDRESSSet theFrom:address of the e-mail.  The address
may be given in either the form
“address@example.com” or “Real Name <address@example.com>.”  If not specified,daemailwill not set theFrom:header and will
expect the mail command or SMTP server to do it
instead.-F,--failure-onlyOnly send an e-mail if the command failed to run or
exited with a nonzero status-lLOGFILE,--logfileLOGFILEIf an unexpected & unhandleable fatal error occurs
after daemonization, append a report toLOGFILE;
defaults todaemail.logSuch an error is a deficiency in the program; please
report it!-MMIME-TYPE,--mime-typeMIME-TYPE,--mimeMIME-TYPEAttach the standard output of the command to the
e-mail as an inline attachment with the given MIME
type.  The MIME type may include parameters, e.g.,--mime-type"text/html;charset=utf-16".  If--stdout-filenameis not also supplied, the
attachment is named “stdout”.  Implies--split.-n,--nonemptyDo not send an e-mail if the command exited
successfully and both the command’s stdout & stderr
were empty or not captured--no-stdoutDon’t capture the command’s stdout; implies--split--no-stderrDon’t capture the command’s stderr; implies--split-S,--splitCapture the command’s stdout and stderr separately
rather than as a single stream--stdout-filenameFILENAMEAttach the standard output of the command to the e-mail
as an inline attachment with the given filename.  If--mime-typeis not also supplied, the MIME type of
the attachment is deduced from the file extension,
falling back toapplication/octet-streamfor
unknown extensions.  Implies--split.-tADDRESS,--toADDRESS,--to-addrADDRESSSet the recipient of the e-mail.  The address may be
given in either the form “address@example.com” or
“Real Name <address@example.com>.”This option is required.  It may be given multiple
times in order to specify multiple recipients.-Z,--utcShow start & end times in UTC instead of local timeCaveatsInput cannot be piped to the command, as standard input is closed when
daemonizing.  If you really need to pass data on standard input, run a shell,
e.g.:daemail bash -c 'command < file'or:daemail bash -c 'command | other-command'