mhmail (1) - Linux Man Pages
mhmail: send or read mail
mhmail - send or read mail
- mhmail [-to] addrs ... [-attach file] [-body text] [-cc addrs ...] [-from addr] [-headerfield name:value] [-subject subject] [-resent] [switches for post ... | -profile [switches for send ...]] [-send | -nosend] [-version] [-help]
- with no arguments is equivalent to inc
DESCRIPTIONmhmail is intended as a replacement for the standard Berkeley mail program (mail or mailx), which is compatible with nmh. This program is intended for the use of programs such as cron, which expect to send mail automatically to various addresses. It is also used by various nmh commands to mail various error notifications. Although mhmail can be used interactively, it is recommended that comp and send be used instead to send messages.
When invoked without arguments, it simply invokes inc to incorporate new messages from the user's maildrop.
When one or more addresses are specified, a message is read from the standard input and spooled to a temporary file. mhmail then invokes post, by default, with the name of the temporary file as its argument to deliver the message to the specified address.
The -subject subject switch can be used to specify the ``Subject:'' field of the message.
The -resent switch indicates that the message body is a fully formed message that will be resent, as dist would do. For example:
mhmail u2 [at] example.com -resent < `mhpath cur`
By default, mhmail will read the message to be sent from the standard input. You can specify the text of the message at the command line with the -body text switch. If the standard input has zero length, mhmail will not send the message and return with status 1. You can use the switch -body ``'' to force an empty message.
Normally, addresses appearing as arguments are put in the ``To:'' field. At least one such address is required when sending a message, i.e., if any other switches are supplied. If the -cc switch is used, all addresses following it, even if there are intervening switches other than -to, are placed in the ``cc:'' field. The optional -to switch can appear in front of any addresses to signify their placement in the ``To:'' field. The -to and -cc switches may be given multiple times.
By using -from addr, you can specify the ``From:'' header of the draft. If no -from switch is used when sending, mhmail will supply a ``From:'' header field using the sender's local mailbox, see localmbox in mh-format(5). Naturally, post will fill-in the ``Sender:'' header correctly.
The -headerfield name:value switch adds a header field with the specified name and value to the message. (The value is called the field body in RFC 2822, but that's too easily confused with the message body.) There need not be a space after the colon that separates the name and value in the argument to this switch. It is usually best to enclose the argument in quotes to protect it from the shell. The -headerfield switch may be given multiple times to add multiple header fields, for example,
mhmail -from sender [at] example.com \ -headerfield 'MIME-Version:1.0' \ -headerfield 'Content-Type:text/plain; charset=utf-8' \ -headerfield 'Content-Transfer-Encoding:8bit' \ recipient [at] example.com
Note about this example: the -attach switch causes MIME-Version and Content-Type headers to be added to the message.
The -profile switch instructs mhmail to use send instead of post to send the message. This allows use of the user's context and aliases.
The -attach file switch attaches the specified file to the message. Use of -attach enables -profile because mhmail uses send to handle the attachment. It is usually best to enclose the argument in quotes to protect it from the shell. The -attach switch may be given multiple times to add multiple attachments.
The -nosend option shows the draft file that would be posted/sent on the command's standard output but does not post or send it. -send provides the default behavior of posting or sending the message. It can be used to disable -nosend, for example, when using a shell alias.
^/usr/bin/inc~^Program to incorporate maildrop into folder ^/usr/libexec/nmh/post~^Program to deliver a message ^/tmp/mhmail*~^Temporary copy of message
SEE ALSOdist(1), inc(1), send(1), mh-format(5), post(8)
`-from localmbox' `-profile' is enabled by default only with -attach `-send'
CONTEXTIf inc is invoked, then inc's context changes occur. With the -profile switch, the context of send is used. mhmail does not read the context file itself, so an entry for it will be ignored.
Linux man pages generated by: SysTutorials