MH & nmh: Email for Users & Programmers

May, 2006

Explanation of mysend

The Section Add Text to Drafts: mysend gives an overview of this script. Here is the mysend script (you might want to open it in a separate browser window). To install it, see the Section Programs in This Book's Archive.

The dosig variable determines whether the script adds a signature or not; the default setting is at the top of the script.

The case statement tests a string that combines the setting of the mhdist environment variable (shown in the Table Environment Variables that MH Sets) with the setting of the dosig shell variable. If mhdist is 1, then the script was called from the dist command (via whatnow). You shouldn't add text to the body of a redistributed message. So the case branches straight to the send command. Otherwise, if the draft file is writable and your $signature file is readable, the script appends a row of dashes and your signature file to the draft message.

Finally, the script runs the MH send command. The arguments, $args, passes all arguments you typed at What now? except -nosig or -sig. Note that any send: arguments from the MH profile are not passed to sendproc scripts like mysend. If you want to set mysend: defaults in your MH profile, use mhparam or mhprofile.

One last note: as the whatnow manual page mentions, if you rename this script to something besides mysend, don't call it send because whatnow won't use it.

mydist

The NOTE in the Section Add Text to Drafts: mysend explains a problem with mysend that keeps the script from working with the MH dist command. The mydist script works around that problem. It disables the mysend script while you dist a message. mydist makes a temporary copy of your MH profile without the sendproc: entry that runs mysend. Then it runs the real dist. Here is the mydist script (you might want to open it in a separate browser window).

There are two ways to install mydist:

  1. Make a shell alias or function named dist that actually runs mydist.
  2. Rename the mydist script to dist. Put it in a directory that's listed before the MH binary directory in your shell search path. That way, the shell will find your version before it finds the real dist. The NOTE: at the start of the script will remind you what dist you're really using.