rtdickerson@lescsse.jsc.nasa.gov (russel dickerson) (03/28/91)
I'm trying to change my from line in my mail messages. The situation is this : I work on a workstation that does not have direct visibility to the internet but does have visibility to an intermediate host who does. I send mail out through this host. However, the host is not configured to handle mail coming back to me so I must use a guest account on that host to get mail. What I want to do is have my mh (xmh actually) place my "dickerson@vf.jsc.nasa.gov" into the return / reply in my message header instead of my internal node-name which isnt visible outside. Any suggestions ? -- Russell Dickerson Internet: dickerson@vf.jsc.nasa.gov Lockheed (LESC), A22 =================================== SSE System Project X Windows & Motif on Apollo/PC/Mac Space Station Freedom Phone +1 713 283 5193
gildea@EXPO.LCS.MIT.EDU (Stephen Gildea) (03/30/91)
How about creating a "components" file which adds a Reply-To: field to your outgoing message template. I guess you would also need replcomps, forwcomps, and distcomps files, too. Seems like a lot of work (four files) for a simple effect, but I don't know a way to always add new headers without disturbing the standard header generation. Does anyone else? < Stephen MIT X Consortium
ziegast@ENG.UMD.EDU (Eric Ziegast) (03/31/91)
Stephen Gildea writes: > Seems like >a lot of work (four files) for a simple effect, but I don't know >a way to always add new headers without disturbing the standard >header generation. Does anyone else? The MH command anno(1) can annotate your messages for you, but it doesn't seem to be used with whatnow. Following this message is a Perl script to use as a filter (sort of) between whatnow(1) and send(1). Even if you don't know Perl, I've added helpful comments so that you can tailor the script to your needs. As it is given, it won't change your message at all. With properly placed print statments, you can add text in the places indicated (*): * HEADER * -------- * BODY * DIRECTIONS: 1. Use the command "which perl" to find out where perl is on your system. If you don't get a path to perl, stop here and complain to your sysop. 2. If what you got was not "/usr/bin/perl" change the first line of the script below to reflect what path was given. 3. Save the script as "annosend" somewhere in your PATH. For example, many people have "~/bin" in their path. (It might be good now to do a "rehash".) 4. Edit annosend to add the lines of text you want. 5. Add (or change) the following line in your .mh_profile: sendproc: annosend Now you're all set. Every time you use comp, repl, forw, etc., your text in annosend will be added to the message. 6. COMPose a simple test message to yourself to make sure it works. I take no responsibility for any of your changes. In fact I take none at all. You should always test programs before you run them. ________________________________________________________________________ Eric W. Ziegast, University of Merryland, Engineering Computing Services ziegast@eng.umd.edu - Eric@(301.405.3689) # REMOVE THIS LINE AND ANYTHING ABOVE IT #!/usr/bin/perl # # Syntax: # annosend DRAFT_FILE # # This is message annotator for use with MH's send(1) command. While it # is a rather trivial Perl script, comments are provided for a user who # has no prior experience with Perl. If you don't have prior experience # with Perl, skip down to BEGIN_EDIT. # Before # Open the draft for read and write if (! -f "$ARGV[$#ARGV]") { die "$0: Draft \"$ARGV[$#ARGV]\" not found.\n\tBad argument to $0?\n"; } open(DRAFT,"+< $ARGV[$#ARGV]") || die "$0: Can't open draft for read/write: $!\n"; # Read in the header and split message into header and body context while (<DRAFT>) { if ($_ eq "--------\n") {$nowbody = ""; next;} if (! defined $nowbody) {$header .= $_; } else { $body .= $_; } } # Rewind for writing seek(DRAFT,0,0) || die "$0: Can't rewind draft: $!\n"; #### BEGIN_EDIT ######################################################## # Here is where you can do your message editing. # If you know Perl, get rid of the comments and cook up something sweet. # If you don't know Perl, listen up: # # The "print" command has the general syntax: # # print FILEHANDLE "TEXT"; # # FILEHANDLE is like a stream used in C's fopen. Of use to you are the # following file handles: # DRAFT - To print to the draft # STDOUT - Standard output # STDERR - Standard error # # TEXT is like text used in C's printf command. A "line" of text would # generally have the format: "a line of text\n" where the "\n" serves as # the end of the "line". Most escape sequences like \t\n\r\f\" and num- # eric escapes like \007 for the bell character will work. # Examples: # # print DRAFT "Reply-to: <guest@uunet.uu.net> (Unlikely)\n"; # print STDERR "\tYou\tdummy!\007\n"; # # NEVER FORGET THE SEMICOLON at the end of a line! # Like C, Perl needs it for a statement seperator. A syntax error will # occur if you forget it. :-( # # On the lines below, add print statements to insert text into your message. # Commented print statements are given as examples. # Insert before the header #print DRAFT "Reply-to: <guest@uunet.uu.net> (Bogus account)\n"; print DRAFT "$header"; # The header itself # Append to the header, before the body #print DRAFT "X-Annotated: Most headers usually go here.\n"; print DRAFT "--------\n"; # The MH header/body seperator # Insert at the beginning of the body #print DRAFT "From the desk of $ENV{'USER'}:\n"; # Note usage of $USER variable here ;-) print DRAFT "$body"; # The message body # Append to the body #print DRAFT "--\nEric Ziegast\nUniversity of Merryland\n"; print STDERR "$0: Message annotated\n"; # All done. Unless you know Perl don't put anything under here. #### END_EDIT ########################################################## close(DRAFT) || die "$0: Can't close draft: $!\n"; system("send $ARGV[0]"); exit 0;