From: CB@brewhq.swb.de (Christian Balzer)
Newsgroups: alt.sys.amiga.uucp,alt.sys.amiga.uucp.patches
Subject: Re: Mail answering program wanted
Date: 19 Aug 92 20:19:25 GMT
Reply-To: CB@brewhq.swb.de (Christian Balzer)
Followup-To: alt.sys.amiga.uucp
Organization: The Software Brewery

In article <ralle.04fq@oberon.dinoco.de> ralle@oberon.dinoco.de (Ralph Niere) writes:
>
>Hello net.folks,
>
>I'm looking for a program that answers my mail while I'm on vacation.
>It should send a reply to each incoming mail including a short message
>telling the sender of the original mail when I'll be back and so on.
>

If you have AREXX, use this:
---
/* MailReflect.Rexx (a vacation mail reflector)

Based on ARexx-Reflector (c) by Friedrich Gentner (fgent@gentle.nbg.sub.org)
   
   Put it in your UUlib:Aliases file like this:
   ---
   # On holidays...
   yourself: /yourself, |MailReflect
   #
   ---
   
   Look at the SOURCE... Change "retdate" and Message below accordingly!
   
   This baby misses a database, but I miss my sleep... ;-)

   Enhancements by Christian '<CB>' Balzer (CB@brewhq.swb.de), based on
   PostIt.rexx (C) 1991 by <CB>
*/

/* !!! Enter your return date here !!! */
retdate="07-Aug-1992"

/* open the Rexx support library */

if ~show('L',"rexxsupport.library") then do
   if addlib('rexxsupport.library',0,-30,0) then do
     say 'Added rexxsupport.library'
   end
   else do
     say 'Support library (LIBS:rexxsupport.library) not available.'
     say 'Aborting...'
     exit(30)
   end
end

if ~exists('t:') then do
  say 'T: has not been assigned, aborting!'
  exit(25)
end

/* Scan UUlib:Config */

if (open(conf,"uulib:config",r)) then do
  do while ~eof(conf) 
    in=readln(conf)
    parse var in key cont
    select
      when upper(key)="NODENAME" then node=strip(cont)
      when upper(key)="USERNAME" then user=strip(cont)
      when upper(key)="DOMAINNAME" then domain=strip(cont)
      when upper(key)="TIMEZONE" then tzone=strip(cont)
      otherwise nop
    end
  end
  err=close(conf)
end
else do
  say 'Configuration file (UUlib:config) not found, aborting!'
  exit(20)
end

site=node || domain
site=space(site,0)

curdate=left(date(w),3)", "date(n) time() tzone

/*

*/

orgfrom = ''
replyto = ''
subject = ''
orgdate = ''
outstr = ''

/* Let's hit the mail */

do while ~eof(stdin)
  inline = readln(stdin)
  upinline = upper(inline)
  if (orgfrom = '') then
    parse var inline 'From: ' orgfrom
  if (replyto = '') then
    parse var inline 'Reply-To: ' replyto
  if (subject = '') then
    parse var inline 'Subject: ' subject
  if (orgdate = '') then
    parse var inline 'Date: ' orgdate
end

/* Use 'From:' line if 'Reply-To:' wasn't supplied */

if (replyto = '') then replyto = orgfrom

/* We only reply to addresses in the form "user@host.domain"  */

if index(replyto,'!') > 0 then exit
if index(replyto,':') > 0 then exit
if index(replyto,'%') > 0 then exit
if index(replyto,'@') < 2 then exit
if index(replyto,'@') > lastpos('.',replyto) then exit

/* Create 'reflector.mail' */

success = open( outfile, "t:mref.mail", "write")
if (~success) then
do
  say 'Can''t access to t:mref.mail'
  exit 10
end

call writeln( outfile, 'To: 'replyto )
call writeln( outfile, 'Cc: ' )
call writeln( outfile, 'Subject: Re: 'subject )
call writeln( outfile, '' )
call writeln( outfile, 'Hi there,' )
call writeln( outfile, '')
call writeln( outfile, 'Your mail message for me has made it to 'site'.' )
/* call writeln( outfile, 'Unfortunately I''m on holiday, but I''ll be back on 'retdate'.' ) */
call writeln( outfile, 'Unfortunately I''m on a business trip, but I''ll be back on 'retdate'.' )
call writeln( outfile, 'For the statistic addicts: ' )
call writeln( outfile, 'Your mail was sent on 'orgdate)
call writeln( outfile, 'and arrived here on 'curdate'.')
call writeln( outfile, '')
call writeln( outfile, 'Note: This message was generated automatically by an ARexx script.' )
call writeln( outfile, '      It will acknowlegde every mail sent to 'user', so please wait')
call writeln( outfile, '      for the return of 'user' before sending more mail.')
call writeln( outfile, '')
call writeln( outfile, 'Hang in tight,' )
call writeln( outfile, '')
call writeln( outfile, '     postmaster@'site )
call close(outfile)

/* Sending it off */

address COMMAND 'sendmail <t:mref.mail -f postmaster -R Vacation-Server'
address COMMAND 'delete t:mref.mail quiet'

exit 0

/* end */
---

<CB>
-- 
  // <CB> aka Christian Balzer, P.O. Box 1348, D-W6108 Weiterstadt, Germany
\X/  -The Software Brewery- Fax/Data: +49 6150 17426, Voice: +49 6150 17427
SWB  CB@frambo.enet.dec.com | CB@brewhq.swb.de | CB@brewhq.swb.sub.org