Subject: Re: procmail: forward when on trip by fax

From: [email-masked] (Ron Dallas )
Date: Wed, 12 Jan 94 08:48:59 EST

Boerge Haga asked in a message dated Jan 12 1994

> I have played with the idea of setting up my mail in a 
> way that will forward my mail to me when I'm away on a trip.
> The forward will be done to a faxgateway that will fax
> certain mails (Not everyone of course. Below a certain
> size and with special senders and/or subjects) to the hotel
> I stay at. In addition I might move around to several places
> and several hotels during the trip. So the forwarding
> address could change during the trip.
> 
> Has anyone implemented anything close to this?
> 
> ....

I did a similar thing with mail forwarding (not using FAX) by having 
procmail recognize a special mail message I sent to myself from the 
remote site. The mail message list the new forwarding address or 
say to turn off forwarding.   This was read by a simple script which
stored the forwarding address in a file procmail recipies could read
to get the forwarding address.  

If you can send yourself mail from the remote site, you could do a 
similar thing.

----

Ron Dallas
Design Technology Group
Teradyne Inc
321 Harrison Ave
Boston, MA  02118
(617) 422-2585  
e-mail:[email-masked]

---

From: [email-masked] (Hans-Albert Schneider)
Date: Wed, 12 Jan 1994 19:31:45 +0100

On Jan 12,  2:09pm, Boerge Haga wrote
on subject "procmail: forward when on trip by fax"
} 
} I have played with the idea of setting up my mail in a 
} way that will forward my mail to me when I'm away on a trip.
} The forward will be done to a faxgateway that will fax
} certain mails (Not everyone of course. Below a certain
} size and with special senders and/or subjects) to the hotel
} I stay at. In addition I might move around to several places
} and several hotels during the trip. So the forwarding
} address could change during the trip.
} 
[...]
} 
} Ideas/Comments/Suggestions?
} 
}-- End of excerpt from Boerge Haga

Supposing you don't have mail access from where you are, you
could try something like this:

Create a file (say ~/whereami) containing a line for every day to
consider. The line should consist of the date, the fax number,
and maybe other information you need, e.g. like this:

12-Jan-94 <SEPARATOR> +47 66 982820 <SEPARATOR> office fax
13-Jan-94 <SEPARATOR> +47 66 982820 <SEPARATOR> office fax
14-Jan-94 <SEPARATOR> +49 89 636 42284 <SEPARATOR> Hans-Albert's fax

Then set up a procmail recipe that pipes the appropriate mail to
a shell script. In this script grep for the date and extract the
info you need, e.g. like this:

  today=`date '+%d-%h-%y'`	# day - month name - year
  line=`grep ^$today ~/whereami \
	| awk -F<SEPARATOR> '{printf("fax=\"%s\"; info=\"%s\"\n", $2, $3)}'`
  eval $line

  cat - | mail-to-fax "$fax" "$info"

Of course, you don't need the "cat -" -- I just put it there to
document that procmail pipes the mail to the stdin of the script.

Because we split the line using awk, <SEPARATOR> must be a single
character and may not be used except as a field separator
throughout ~/whereami.

You could also play around with expr(1) to do arithmetic
comparison of the date (use "date +%y%m%d" then -- it gives you
year - month number - day without hyphens, e.g. 940112).

Hans-Albert

--
Hans-Albert Schneider		<[email-masked]>
Siemens AG				phone:	(+49) 89 636 45445
Corporate Research and Development	fax:	(+49) 89 636 42284
Munich, Germany