From owner-freebsd-current Tue Mar 25 22:14:13 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id WAA19088 for current-outgoing; Tue, 25 Mar 1997 22:14:13 -0800 (PST) Received: from mercury.Sun.COM (mercury.Sun.COM [192.9.25.1]) by freefall.freebsd.org (8.8.5/8.8.5) with SMTP id WAA19083 for ; Tue, 25 Mar 1997 22:14:09 -0800 (PST) Received: from East.Sun.COM ([129.148.1.241]) by mercury.Sun.COM (SMI-8.6/mail.byaddr) with SMTP id WAA26377; Tue, 25 Mar 1997 22:17:06 -0800 Received: from suneast.East.Sun.COM by East.Sun.COM (SMI-8.6/SMI-5.3) id BAA12407; Wed, 26 Mar 1997 01:13:31 -0500 Received: from compound.east.sun.com by suneast.East.Sun.COM (SMI-8.6/SMI-SVR4) id BAA06778; Wed, 26 Mar 1997 01:13:29 -0500 Received: (from alk@localhost) by compound.east.sun.com (8.8.5/8.7.3) id GAA01499; Wed, 26 Mar 1997 06:13:27 GMT Date: Wed, 26 Mar 1997 06:13:27 GMT Reply-To: Anthony.Kimball@East.Sun.COM Message-Id: <199703260613.GAA01499@compound.east.sun.com> From: Tony Kimball MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: current@freebsd.org Cc: ville@vlsi.fi Subject: Suggested fetchmail port addition (was: Re: Fetchmail nolonger working) X-Face: O9M"E%K;(f-Go/XDxL+pCxI5*gr[=FN@Y`cl1.Tn Sender: owner-current@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Quoth Ville Eerola on Wed, 26 March: : Normally fetchmail uses SMTP : connection to the localhost to deliver the messages it downloads from : the mail sever. Thus, you need to have a MTA listening to port 25 on : the host runnig fetchmail, or alternatively you need to configure : fetchmail to use a local MDA directly. Speaking of which, here is a local MDA I use in order that I do not have to run a local sendmail. Unless I am overlooking equivalent functionality already hidden somewhere in the base OS, it might be useful to include this in the fetchmail port. /home/alk/.fetchmailrc: server subtle proto imap user alk pass ******** mda /usr/local/bin/catmail server saphire proto imap port 3131 user alk pass ******** mda /usr/local/bin/catmail server perham proto pop3 user alk pass ******** mda /usr/local/bin/catmail /usr/local/bin/catmail: #!/usr/bin/perl # # name: # catmail # description: # a mail delivery agent in perl # usage: # catmail [-{q,v}]* < mailstream # environment: # MAIL path to spool file # synopsis: # delivers a single mail message on stdin to the user spool file # specified by the environment. # author: # alk@pobox.com # date: # 12 Mar 97 # $verbose=0; $quiet=1; while ($ARGV[0]) { if ($ARGV[0] =~ '^-.*[vV]') { $verbose=1; } if ($ARGV[0] =~ '^-.*[qQ]') { $quiet=0; } shift; } $mail=$ENV{'MAIL'}; if (! $mail) { $mail=$ENV{'SPOOL'}; } if (! $mail) { $_=$ENV{'USER'}; if (!$_) { $_=$ENV{'HOME'}; if ($_) { s,.*/,,g; } } if (-d '/var/mail') { $mail="/var/mail/$_"; } elsif (-d '/usr/spool/mail') { $mail="/usr/spool/mail/$_"; } } $_=$mail; $user=s,.*/,,g; die "Unable to set spool file path" unless $mail; die "Unable to open spool file $mail" unless open(MAIL,">>$mail"); $line=0; $replyto=''; $returnpath=''; $from=''; while () { if (/^Reply-To: ([-_.A-Za-z0-9]*@[-_.A-Za-z0-9]*).*/) { $replyto=$1; $header[$line++]=$_; } elsif (/^Return-Path: .*<([-_.A-Za-z0-9]*@[-_.A-Za-z0-9]*)>.*/) { $returnpath=$1; $header[$line++]=$_; } elsif (/^From: .*<([-_.A-Za-z0-9]*@[-_.A-Za-z0-9]*)>.*/) { $from=$1; $header[$line++]=$_; } elsif (/^[A-Z][-A-Za-z]*: .*/) { $header[$line++]=$_; } elsif (/^\t/) { $header[$line++]=$_; } elsif (/^ /) { $header[$line++]=$_; } else { $keep=$_; last; } } if ($from) { $xfrom=$from; } elsif ($replyto) { $xfrom=$replyto; } elsif ($returnpath) { $xfrom=$returnpath; } else { $xfrom=$user } @WEEK=('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'); @MONTH=('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'); ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); if ($year > 38 && $year <= 99 ) { $cent = 19; } else { $cent = 20; } printf MAIL "From %s %s %s %d %d:%02d:%02d %02d%02d\n", $xfrom,$WEEK[$wday],$MONTH[$mon],$mday,$hour,$min,$sec,$cent,$year || die "Unable to append to $mail"; if ($verbose) { print ":"; } for ($i=0; $line--; ) { print MAIL $header[$i++] || die "Unable to append header line $i to $mail"; if ($verbose) { print ","; } } print MAIL "$keep"; while () { $i++; print MAIL $_ || die "Unable to append mail line $i to $mail"; if ($verbose) { print "."; } } if ($verbose) { print "\n"; } if (! $quiet) { print "$i lines output\n"; } close(MAIL);