----------
X-Sun-Data-Type: text
X-Sun-Data-Description: text
X-Sun-Data-Name: text
X-Sun-Content-Lines: 120
Since my first summary was way to premature, here's a more complete summary.
Original question:
==================
How do I include a signature in mailtool?
I got LOADS of answers, with many different suggestions.
Thank you all who responded:
dll@breacad.beckman.com
bern@TI.Uni-Trier.DE
cbarker@cp.tybrin.com
Garry.Robbins@Labatt.Com
phubbard@baosc.com
fhb@kestnbaum.com
sitongia@ncar.ucar.edu
earl@texmemsys.com
peet@smtpgate.Disclosure.COM
fletch@ain.bls.com
tkha@wsgc.com
Johnny.Hui@artecon.com
jcr@ipl.bwh.harvard.edu
sitongia@zia.hao.ucar.edu
michael.shon@East.Sun.COM
sunm@erm.oz.au
a.kemp@fml.co.uk
I hope I didn't forget anyone. Anyway, here's the summary:
Five (!) different solutions:
============================
1. Use the Template menu in mailtool
Create a $HOME/.signature with your signature in it.
Use Edit | Properties | Template to add .signature as a template.
Use Include | Template to add a signature at the cursor in each mail.
This works, but is a bit tiresome. And it doesn't handle mail from the shell prompt.
2. Bind a key to echo your signature
Create a $HOME/.signature with your signature in it.
Modify (or create) $HOME/.textswrc by adding these line:
# Add signature if R3 pushed:
KEY_RIGHT(3) FILTER
cat $HOME/.signature
Remember to comment out any previous definition of KEY_RIGHT(3) in .textswrc
This will echo you signature each time you press "Scroll Lock".
It works fine, but it would be nice to include it automatically...
3. A short shell script
I received a few different versions of scripts which just cat a signature to the end of each mail.
One of the more elaborate versions are added as attachment
"signmail.sh". This script adds a signature only if the address has an "@" in
it, i.e. the mail is external. It can also add fortune to your mail.
Here's how you use it:
Create a $HOME/.signature with your signature in it.
Save the script as signmail.sh.
Add this line to $HOME/.mailrc:
set sendmail=/your/home/bin/signmail.sh
This works for plain mails, but not for sun attachments, since the signature
will just be appended at the very end of the whole lot.
4. A long perl script
The perl script is attached to this mail as "signmail.perl". Use it like this:
Create a $HOME/.signature with your signature in it.
Save the script as signmail.perl.
You need perl (of course), in this case in /usr/local/bin.
Add this line to $HOME/.mailrc:
set sendmail=/your/home/bin/signmail.perl
This is a very nice solution, and the one I chose. It adds the signature to the
end of each mail, before all the attachments. It has one limitation though, which I discovered:
There mustn't be any long lines with ------- in your mail
(no more than 9 hyphens in a row) or the signature will be inserted there.
This is because such lines are used to separate the attachments.
5. Joes Mailtool
>From bern@uni-trier.de I got info on his solution, a more complete package called Joes Mailtool.
I quote from the description:
You may startle about those two Scripts with a total Size of 16 kB, but this
is what you get from it:
-- Most Mails (unless you use cryptographic Signatures heavily) will be
composed and sent *exactly* the Way you do it now - no additional Fuss
to be made.
-- Does .signature's and fancy Headers; You can have separate Signatures
for JoesMailtool and "the Rest" (think of Newsreaders with their Line
Limit on Signatures)
-- You can run ROT13 and ispell on the outgoing Mail (and choose whether
you ROT13 first and .sig later or vice versa ;-)
-- You have a full Range of PGP and RIPEM Processing at your Choice
I haven't tried it myself due to lack of time, but I recommend that you check it out.
Get automatic info by sending a mail to
mailtool-sig@ti.uni-trier.de, or get the tool from
ftp.informatik.uni-trier.de:/pub/sunos/JoesMailtool/
Have fun!
Marcus
========================================================================
Marcus Filipsson, Research Engineer Email: marcus.filipsson@ling.lu.se
Tel: +46-(0)46-108449 Fax: +46-(0)46-104210
Dept. of Linguistics, Lund University WWW:http://www.ling.lu.se
Helgonabacken 12, 223 62 Lund, SWEDEN
========================================================================
----------
X-Sun-Data-Type: shell-script
X-Sun-Data-Name: signmail.sh
X-Sun-Content-Lines: 55
#! /bin/sh
#
# @(#)fmt_mail 1.5 89/03/17 SMI
# modified to add signatures - Bruce Barnett
# modified to add headers - Gary Parker
# modified to add a fortune to signature - Gary Parker
# modified to run with the Solaris grep - Earl Manning
#
# Create a new fortune file for append to signature
#if [ -f ${HOME}/.fortdat ]; then
# rm ${HOME}/.fortdat
#fi
#if [ -x /usr/games/fortune ]; then
# /usr/games/fortune -s >${HOME}/.fortdat
#fi
#
# Test to see if everything is local, if local then no signature
#
for i
do name=$i
done
#
# Add custom headers if they exist. Comment out if not wanted.
#cat ${HOME}/.mymailheaders - | \
#
# Don't mess with this stuff ...
(IFS_save=$IFS
#solves problem of read line discarding leading blanks which are necessary
#for correct interpretation of continuation lines in mail headers
IFS=
while read line
do
echo "$line"
case $line in
"") break ;;
esac
done
IFS=$IFS_save
cat) | \
#
# taken out on 12-6-94 because could not send uuencode messages
#
#fmt -s -80) | \
#
# Add signature if it exists. Comment out otherwise.
(if `echo $name | grep -s "@" > /dev/null `
then cat - ${HOME}/.signature
else cat -
fi) | \
#
# Add fortune to end if it exists. Comment out otherwise.
#cat - ${HOME}/.fortdat | \
#
# Don't mess with this either
/usr/lib/sendmail "$@"
----------
X-Sun-Data-Type: default-app
X-Sun-Data-Name: signmail.perl
X-Sun-Content-Lines: 156
#!/usr/local/bin/perl
#
# What Goes On Here
#
# At the very simplest, this program accepts data on STDIN from MailTool,
# appends the user's $HOME/.signature file to the stream, and pipes the
# whole mess to sendmail.
#
# However, enclosures are a sticky point. Therefore, the program must
# not simply append the signature, but must determine where it should
# append the signature without corrupting any enclosures in the message.
#
# If a person sends a message and adds an enclosure(s), the signature is
# appended into the main message body (which is, actually, the first enclosure
# in the message.) If the sender sends an enclosure without any message
# body, the program detects this and simply creates an additional enclosure
# for the signature file. It seems to work.
#
# To activate this program via mailtool, add the following line to your
# .mailrc file:
#
# set sendmail=/path/to/signmail
#
# Copyright (c) 1994 Clay Luther. August 1994.
# clay@inetinc.com
# This software is protected under the GNU Software License Agreement.
#
$VERSION="1.1";
# HISTORY
# Version 1.0
# Version 1.1 - fixed to work with perl5; fixed tainted variable problem
$SIGFILE = $ENV{'HOME'} . "/.signature";
# ^^^^^^^^^^^ at least that's where most are
$LF = "\n";
$HERALDENCLOSURE = 0;
$FOUNDMAINTEXT = 0;
$MARKER = "----------";
$HEADERS = 1;
$SIGNATUREPRINTED = 0;
$ARGUMENTS = join(' ', @ARGV);
$LINES = &sigLines();
# Setup the environment
$ENV{'PATH'} = ''; # '/bin:/usr/bin';
$ENV{'SHELL'} = '/bin/sh';
$ENV{'IFS'} = '' if $ENV{'IFS'} ne '';
@INC = $INC[$#INC - 1];
die "Perl library is writable by world!!!\n" if $< && -W $INC[0];
umask(077);
# Untaint the arguments
$ARGUMENTS =~ /^([\w.]*)$/;
$ARGUMENTS = $1;
open(MAIL, "| /usr/lib/sendmail -oi -t $ARGUMENTS") || die "can't fork: $!\n";
while (<STDIN>)
{
$SAVE_ = $_;
if ($HEADERS)
{
if (/^Content-Type:\s*X-sun-attachment/) { $HERALDENCLOSURE = 1; }
if (/^\n/)
{
print MAIL "X-Signmail: $VERSION. A Mailtool extension by Clay Luther.\n";
$HEADERS = 0;
}
}
else
{
if ($HERALDENCLOSURE)
{
if (/^X-Sun-Data-Name: text/)
{
$FOUNDMAINTEXT = 1 if (!$FOUNDMAINTEXT);
}
elsif (/^$MARKER/)
{
if ($FOUNDMAINTEXT)
{
$HERALDENCLOSURE = 0;
&printSignature();
}
}
elsif (/^X-Sun-Content-Lines:/)
{
if ($FOUNDMAINTEXT && $HERALDENCLOSURE)
{
m/^X-Sun-Content-Lines:\s(\d*)/;
if ($1)
{
local($tlines) = $1 + $LINES + 2;
$SAVE_ = "X-Sun-Content-Lines: $tlines\n";
}
}
}
}
}
print MAIL $SAVE_;
}
if (!$SIGNATUREPRINTED)
{
&printSignature();
}
close(MAIL) || die "pipe exited $?\n";
exit 0;
##########
sub printSignature
{
if (-r $SIGFILE)
{
if (open(SIGNATURE, "<$SIGFILE"))
{
if ($HERALDENCLOSURE)
{
print MAIL $LF . $MARKER . $LF;
print MAIL "X-Sun-Data-Type: text\n";
print MAIL "X-Sun-Data-Description: text\n";
print MAIL "X-Sun-Data-Name: signature\n";
print MAIL "X-Sun-Charset: us-ascii\n";
print MAIL "X-Sun-Content-Lines: $LINES\n\n";
}
else
{
print MAIL "\n\n";
}
while (<SIGNATURE>) { print MAIL $_; }
}
close(SIGNATURE);
}
$SIGNATUREPRINTED = 1;
}
sub sigLines
{
if (! -r $SIGFILE) { return 0; }
open(SF,"<$SIGFILE") || return 0;
local($cnt) = 0;
while (<SF>) { $cnt++; }
close(SF);
return $cnt;
}
This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:10:27 CDT