redirect.at 3.31 KB
# This file is part of GNU Mailutils. -*- Autotest -*-
# Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
#
# GNU Mailutils is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Mailutils.  If not, see <http://www.gnu.org/licenses/>.

AT_SETUP([redirect])
AT_KEYWORDS([action])

AT_CHECK([
MUT_PREREQ_CAPA([ENABLE_SENDMAIL])
MTA_DIAG=`pwd`/mta.diag
MTA_APPEND=1
export MTA_DIAG MTA_APPEND

AT_DATA([prog],[
require "redirect";

redirect "gray@gnu.org";
])
MUT_MBCOPY($abs_top_srcdir/testsuite/spool/MUT_SIEVE_MAILBOX)

sieve MUT_SIEVE_CMDLINE MUT_SIEVE_OPTIONS -f ./MUT_SIEVE_MAILBOX prog || exit 1
sed 's/ $//' ./mta.diag
],
[0],
[ENVELOPE FROM: coyote@desert.example.org
ENVELOPE TO: <gray@gnu.org>
   0: X-Loop-Prevention: foobar@nonexistent.net
   1: From: coyote@desert.example.org
   2: To: roadrunner@acme.example.com
   3: Subject: I have a present for you
   4: X-Caffeine: C8H10N4O2
   5: 
   6: Look, I'm sorry about the whole anvil thing, and I really
   7: didn't mean to try and drop it on you from the top of the
   8: cliff.  I want to try to make it up to you.  I've got some
   9: great birdseed over here at my place--top of the line
  10: stuff--and if you come by, I'll have it all wrapped up
  11: for you.  I'm really sorry for all the problems I've caused
  12: for you over the years, but I know we can work this out.
  13: 
  14: --
  15: Wile E. Coyote   "Super Genius"   coyote@desert.example.org
  16: 
END OF MESSAGE
ENVELOPE FROM: b1ff@de.res.example.com
ENVELOPE TO: <gray@gnu.org>
   0: X-Loop-Prevention: foobar@nonexistent.net
   1: From: youcouldberich!@reply-by-postal-mail.invalid
   2: To: rube@landru.example.edu
   3: Subject: $$$ YOU, TOO, CAN BE A MILLIONAIRE! $$$
   4: Date: TBD
   5: X-Number: 0015
   6: 
   7: YOU MAY HAVE ALREADY WON TEN MILLION DOLLARS, BUT I DOUBT
   8: IT!  SO JUST POST THIS TO SIX HUNDRED NEWSGROUPS!  IT WILL
   9: GUARANTEE THAT YOU GET AT LEAST FIVE RESPONSES WITH MONEY!
  10: MONEY! MONEY! COLD HARD CASH!  YOU WILL RECEIVE OVER
  11: $20,000 IN LESS THAN TWO MONTHS!  AND IT'S LEGAL!!!!!!!!!
  12: !!!!!!!!!!!!!!!!!!111111111!!!!!!!11111111111!!1  JUST
  13: SEND $5 IN SMALL, UNMARKED BILLS TO THE ADDRESSES BELOW!
  14: 
END OF MESSAGE
ENVELOPE FROM: bar@dontmailme.org
ENVELOPE TO: <gray@gnu.org>
   0: X-Loop-Prevention: foobar@nonexistent.net
   1: Received: (from bar@dontmailme.org)
   2: 	by dontmailme.org id fERKR9N16790
   3: 	for foobar@nonexistent.net; Fri, 28 Dec 2001 22:18:08 +0200
   4: Date: Fri, 28 Dec 2001 23:28:08 +0200
   5: From: Bar <bar@dontmailme.org>
   6: To: Foo Bar <foobar@nonexistent.net>
   7: Message-Id: <200112232808.fERKR9N16790@dontmailme.org>
   8: Subject: Coffee
   9: 
  10: How about some coffee?
  11: 
END OF MESSAGE
],
[REDIRECT on msg uid 1: to gray@gnu.org
REDIRECT on msg uid 2: to gray@gnu.org
REDIRECT on msg uid 3: to gray@gnu.org
])

AT_CLEANUP