Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!news.rmit.EDU.AU!news.unimelb.EDU.AU!cs.mu.OZ.AU!munnari.OZ.AU!news.Hawaii.Edu!news.uoregon.edu!hunter.premier.net!feed1.news.erols.com!howland.erols.net!newsfeed.internetmci.com!in3.uu.net!picard.chickasaw.com!picard.chickasaw.com!smcmahon From: Shawn McMahon <smcmahon@chickasaw.com> Newsgroups: comp.unix.bsd.bsdi.misc Subject: repop Date: Thu, 10 Oct 1996 10:17:57 -0500 Organization: Chickasaw Nation Net Lines: 95 Message-ID: <Pine.BSI.3.95.961010100758.20518A-100000@picard.chickasaw.com> NNTP-Posting-Host: picard.chickasaw.com Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Just gonna post this once; if you miss it, check an archive or email me. Some folks asked me to also post to bsdi-users; I'm not going to, because I don't feel right about posting programs in a mailing list unless they're of interest to EVERYBODY; even short ones. This is the script Bill Warner came up with for using MH to safely incorporate mail from a remote POP3 server into your local mailbox. Or, for that matter, any mailbox you like. It's easily modified for multiple remote servers; just stick more "inc" lines in. Feel free to hardcode them; Bill's a good programmer by habit, but this is a short script and hardcoding won't hurt anybody. You should probably read the man pages for MH, especially the one for "inc", before you use this, if you're not familiar with MH. Please leave Bill's comments intact if you redistribute this. BTW, apologies to all and to David Newall. If you don't know why, don't worry about it. ------------cut here--------------- #!/bin/sh # # $Id: repop,v 2.0 1996/10/07 17:45:45 lww Rel $ # # repop - Redistribute messages from a POP server. # # repop uses inc to pull messages for $POPUSER from $POPHOST. Messages are # temporarily held in the MH folder $POPFOLDER. Messages are resent to # $DESTINATION and then removed from $POPFOLDER. $DESTINATION does not have to # be a local address. It can be any valid email address. inc will prompt for # the POP password for $POPUSER. If $POPFOLDER does not exist, inc will prompt # for permission to create it. # # WARNING: Using the "mail.local" version of this script may cause corrupted # mail drops and/or lost email. If you don't understand why, don't use it! # See the comments below for further details. # # Bill Warner <lww@ictech.com> PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/contrib/mh/bin export PATH umask 077 DISTCOMPS=/tmp/distcomps.$$ trap 'rm -f $DISTCOMPS' 0 1 2 3 6 15 # Edit these variables to suit your configuration # # POPFOLDER = the MH folder where inc will deposit mail from POP server # POPHOST = the POP server # POPUSER = the user name of the POP account # DESTINATION = the address to which all messages will be resent # POPFOLDER=+popin POPHOST=pop POPUSER=test DESTINATION=lww echo "Pulling messages from POP server: $POPHOST" inc $POPFOLDER -host $POPHOST -user $POPUSER -norpop set -e MESSAGES="`scan $POPFOLDER -format '%(msg)' all`" echo "Resent-To: $DESTINATION" > $DISTCOMPS # To use mail.local for delivery instead of dist, uncomment this "cd" and the # "mail.local" line in the loop below. Also, comment out the "dist" line. If # you do this be aware that $DESTINATION must be a local username. It cannot # be a remote address or an alias. Also, if you use something other than # mail.local as your local mailer (defined by Mlocal in /etc/sendmail.cf), # procmail for example, this may be ***dangerous***. The file locking styles # of mail.local and alternate local mailers may not be the same. This may # result in corrupted mail drops and/or lost email. Do not use this option # unless you know exactly what you are doing. You have been warned! # # Additionally, if mail.local is used directly there will be no record of this # extra delivery hop in either the message headers or the sendmail logs. # #cd `mhpath $POPFOLDER` for MSG in $MESSAGES do dist $POPFOLDER $MSG -form $DISTCOMPS -whatnowproc send # /usr/libexec/mail.local $DESTINATION < $MSG echo -n "Message $MSG resent" rmm $MSG echo ", and removed from $POPFOLDER." done exit 0 ----------------cut here-------------- Shawn McMahon | Smokesignals Computer Company Senior System Operator | Southern Oklahoma's Internet Service Provider Chickasaw Nation Net | 405 332-0033 http://www.chickasaw.com