------------------------------------------------------------------------------- WARNING; do not set the "hostname" to 127.0.0.1 interface in /etc/hosts or the w and j defines will not be correct. ------------------------------------------------------------------------------- Send a RAW File with sendmail (See also "client_hints.txt") @ > test file=test ( echo "To: user@example.com" echo "Subject: File $file from $HOST" echo "" cat $file echo "" echo "Signed: 'send this file' script" ) | sendmail -t -v ------------------------------------------------------------------------------- Specific Debug flag usage... List all defined variables /usr/lib/sendmail -d35.9 -C/dev/null -bt 3,0 address Trace the rule sets /usr/lib/sendmail -d21.12 -bt > 5 anthony ------------------------------------------------------------------------------- Extracting a FROM list from syslog We need a list of the from addresses of mail sent to USER on a sun UNIX machine. The following is how I extracted this information from the syslog files on that machine. First cd to system logs directory cd /var/log See if anything is present... grep -i USER syslog.{7,6,5,4,3,2,1,0} syslog NOTE the reverse (or time) order of the syslogs, you can limit the number of syslog files so as to only cover the period required. (NOTE {} preserves the order given, while [] does not) An alturnative way to do the file list reversal is grep -i USER `ls syslog* | perl -e 'print reverse <>'` You may also like to check for other mail aliases of the user. For example also look for I.Surname instead of users login name. extract the `mail IDs' egrep -i 'to='` |\ cut -d: -f5 > ~/t extract the people who sent these mail ID's and time mail was sent... grep from= `ls syslog* | perl -e 'print reverse <>'` |\ fgrep -f ~/t | awk '{print $1, $2, $3, $7}' > ~/t2 Final clean up and formating cut -d: -f2- ~/t2 | sed 's/>*,$//;s/from=<*/ /;' > ~/t3 The output of the above (file ~/t3 ) can be mailed or printed to the user concerned. ------------------------------------------------------------------------------- Extract a summery of "gu.edu.au" from addresses seen by sendmail perl -ne 'next unless / sendmail\[/;\\ next unless / from=<([^>]+?)\.?gu\.edu\.au>,/;\\ print "$1\n"' maillog* |\ tr A-Z a-z | sort | uniq -c > ~/from_addrs ------------------------------------------------------------------------------- Clean sendmail queue (remove old un-needed files) cd /var/spool/mqueue mailq ls find [xtTQ]f* -mtime +1 -print | xargs rm # This is usally not needed find . -name 'df*' | sed 's/^\.\/d/X/' | sort > td find . -name 'qf*' | sed 's/^\.\/q/X/' | sort > tq wc td tq # But if qf* and df* file counts don't match remove the other comm -23 tq td | sed 's/^X/q/' | xargs rm comm -13 tq td | sed 's/^X/d/' | xargs rm rm tq td ------------------------------------------------------------------------------- Encrypted Sendmail > Does anyone know of any SMTP applications that will encrypt both messages > and attachments on the fly before transmission to the internet? Two solutions that come to mind, each quite different. Who are you sending the emails to? Sendmail supports Transport Layer Security (TLS) to allow you to encrypt the entire ESMTP transaction. This requires support on the receiving end. I've used this to ensure email to a certain domain is is encrypted whilst other email goes out unencrypted. Alternatively, you could have the mail server use GnuPG and ISPMailGate to encrypt all emails. The empty passphrase needed isn't a problem because the private key provides *equivalency* to this server being trusted. Yours sincerely, Mark Suter - www.zwitterion.org From Sage-SU mailing list) ------------------------------------------------------------------------------- NFS mounting /var/spool/mail && file locking A while ago, I posted a question asking what the deal was with having a single /var/spool/mail mounted via NFS on many machines. I was curious whether lockd bugs could cause mail to be lost. Specifically, I was interested in how SunOS and Ultrix dealt with this, and how elm and sendmail fit into the picture. I apologize for taking so long to summarize; there are two main things that I found out: 1) Mail user agents (/usr/ucb/mail -- Ultrix & SunOS, elm, etc.) generally use a second file to lock the mailbox such as /usr/spool/mail/mosedale.lock. This seems to keep many problems at bay. 2) It is considered a very good idea to have the mail transfer agent (eg sendmail) on the subsidiary machines punt all incoming mail to /var/spool/mail's home machine and have it delivered only on that home machine. In SunOS, this is done by setting up sendmail.cf to use the OR command (see /usr/lib/sendmail.subsidiary.cf). Ultrix sendmail looks like it may a similar capability, but I'm not entirely clear on how it works. IDA sendmail can do this using the MAILSERVER macro in the m4 source file for sendmail.cf. The general consensus seems to be that these measures are reasonable solutions, and almost no-one has had any lost mail problems once these are in place. Thanks to everyone who helped me out. Dan Mosedale mosedale@genome.stanford.edu -------------------------------------------------------------------------------