From owner-freebsd-questions Tue Feb 16 08:17:23 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id IAA05175 for freebsd-questions-outgoing; Tue, 16 Feb 1999 08:17:23 -0800 (PST) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from uucp2.msen.com (uucp2.msen.com [148.59.19.26]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id IAA05163 for ; Tue, 16 Feb 1999 08:17:19 -0800 (PST) (envelope-from zach@bane.mi.org) Received: (from root@localhost) by uucp2.msen.com (8.8.8/8.7.3) with UUCP id KAA06786; Tue, 16 Feb 1999 10:35:08 -0500 (EST) Received: from bane.mi.org (zach@bane.mi.org [10.1.1.1]) by bane.mi.org (8.8.7/8.8.4) with SMTP id KAA09201; Tue, 16 Feb 1999 10:33:56 -0500 Date: Tue, 16 Feb 1999 10:33:56 -0500 (EST) From: Zach Smith To: kok cc: FreeBSD Questions Subject: Re: mail setting In-Reply-To: <36C98266.120973D6@stlinux.ouhk.edu.hk> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG here is an example of how you could do this with a simple mail filer script and a .forward file. This way, you don't need to rely on system files or alias db's. Please note, I wrote this in 5 mins and only tested it about 5 times. It should work for very simple messages but it is meant to be an example of how you could do this, not necessarily the "way" to do this. Here is the script: mf.pl ---BEGIN SCRIPT--- #!/usr/local/bin/perl # file where your mail is stored. usually something like /var/spool/mail/USER $mailfile="/var/spool/zach"; # where you want the mail to go $forwardaddress="zsmith1\@ford.com"; # because this is going to be invoked via a pipe, we can just read STDIN :) while(<>) { #push everyline read into the @mail list push(@mail,$_); } # open you system mail file...$mailfile open(MAIL,">>$mailfile") || die("Coulnd not open $mailfile: $!\n"); # print the e-mail message stored in @mail to the $mailfile print MAIL @mail; # close the mail file close(MAIL); # open a pipe to mail to send the message to the other account open(ALTMAIL,"|mail $forwardaddress") || die("Could not open mail pipe: $!\n"); # print the message stored in @mail the pipe print ALTMAIL @mail; # close the pipe close(ALTMAIL); ---END SCRIPT--- Make sure this is executable because it will need to be executed. Next, place this line in your .forward file: | /PATH_TO_THE_SCRIPT/mf.pl Where "PATH_TO_THE_SCRIPT" is where you put mf.pl Again, please make sure you test this a lot and make any modifications you need to fit your setup. Good luck :) Zach Smith +-------------------+ | UNIX Nerd | | & | | Professional Geek | +-------------------+ zach@bane.mi.org On Tue, 16 Feb 1999, kok wrote: > Hello > > i would like to know how to make mail setting: > > forward mail to althernative mail account but keep mail to original > account. > > i know file .forward which can only forward to althernate mail account > but couldn't keep mail to original account! > > Thank you for your help > > kok > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message