# Copyright (c) 2005-2006 bivio Software, Inc. All rights reserved. # # Visit http://www.bivio.biz for more info. # # This library is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation; either version 2.1 of the # License, or (at your option) any later version. # # This library 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 # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; If not, you may get a copy from: # http://www.opensource.org/licenses/lgpl-license.html # # $Id: Outgoing.bunit,v 1.6 2011/02/06 01:47:57 nagler Exp $ Request('initialize_fully'); # use User::pwent (); # my($_USER) = $ENV{LOGNAME} || $ENV{USER} || User::pwent::getpwuid($>)->name; # Bivio::IO::Alert->warn('You will receive two identical mail messages'); my($_USER) = 'nobody@example.com'; my($_IN) = <<'EOF'; Received: (from majordomo@localhost) by bivio.com (8.8.7/8.8.7) id HAA23244 for example.com; Thu, 1 Jul 1999 07:43:10 -0600 Received: from lists.bivio.com) by foo.example.com (8.8.7/8.8.7) with SMTP id HAA23241 for ; Thu, 1 Jul 1999 07:43:09 -0600 Message-ID: <123@example.com> From: "Fan Tango" To: "Some-List" , to@example.com Date: Thu, 1 Jul 1999 09:33:35 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mimeole: Produced By Microsoft MimeOLE V4.72.3110.3 List-Unsubscribe: CC: cc@example.com Subject: This is my subject Reply-To: " Some-List" Sender: owner-some-list@bivio.com Return-Receipt-To: nagler@acm.org Four score and seven years ago... Fan Tango $somevar EOF my($_OUT) = <<'EOF'; Return-Path: Message-ID: <123@example.com> Date: Thu, 1 Jul 1999 09:33:35 -0400 From: "Fan Tango" Subject: [abc] This is my subject Sender: some-list-owner@a.a To: "Some-List" , to@example.com CC: cc@example.com Reply-To: some-list@example.com MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit List-Unsubscribe: X-Bivio-Forwarded: 1 X-Mimeole: Produced By Microsoft MimeOLE V4.72.3110.3 X-MSMail-Priority: Normal X-Priority: 3 Four score and seven years ago... Fan Tango $somevar EOF my($_WITH_CC) = <<'EOF'; Message-ID: <123@example.com> From: from@from.from Cc: cc@cc.cc Date: Thu, 1 Jul 1999 09:33:35 -0400 body EOF my($_WITHOUT_CC) = <<'EOF'; Message-ID: <123@example.com> From: from@from.from Date: Thu, 1 Jul 1999 09:33:35 -0400 body EOF my($_BODY) = 'what a body'; [ [Bivio::Mail::Incoming->new(\$_IN)] => [ set_headers_for_list_send => [ [{ list_email => 'some-list@example.com', sender => 'some-list-owner@a.a', subject_prefix => '[abc] ', reply_to_list => 1, }] => undef, ], unsafe_get_recipients => [ [] => [undef], ], set_recipients => [ [[$_USER, 'joe@example.com'], req()] => undef, ], unsafe_get_recipients => $_USER . ',joe@example.com', set_recipients => [ [$_USER, req()] => undef, ], unsafe_get_recipients => $_USER, unsafe_get_header => [ 'Date' => "Thu, 1 Jul 1999 09:33:35 -0400", 'Not_Found' => [undef], ], format_as_bounce => [ ['bad, bad, bad', undef, undef, undef, req()] => qr{ERROR.*$_USER.*bad, bad, bad.*Original}s, ], send => [ [req()] => undef, ], enqueue_send => [ [req()] => undef, ], inline_commit(), as_string => $_OUT, set_body => [ [\$_BODY] => undef, ], send => [ [req()] => undef, ], as_string => sub { $_OUT =~ /(^.*?\n\n)/s; return [$1 . $_BODY]; }, add_missing_headers => [ [req()] => undef, ], as_string => qr{Return-Path: \nMessage-ID}is, ], [Bivio::Mail::Incoming->new(\$_IN)] => [ set_headers_for_list_send => [ [{ list_email => 'some-list@example.com', reply_to_list => 0, sender => 'a@a.a', reply_to => 'b@b.b', return_path => 'c@c.c', }] => undef, ], unsafe_get_header => [ to => '"Some-List" , to@example.com', cc => 'cc@example.com', 'return-path' => '', from => '"Fan Tango" ', sender => 'a@a.a', 'reply-to' => undef, ], edit_body => [ [{somevar => 'ReplacedVar'}] => not_die(), ], get_body => qr{ReplacedVar}, ], [Bivio::Mail::Incoming->new(\$_WITH_CC)] => [ set_headers_for_list_send => [ [{ list_email => 'some-list@example.com', }] => undef, ], unsafe_get_header => [ to => 'cc@cc.cc', cc => undef, ], ], [Bivio::Mail::Incoming->new(\$_WITHOUT_CC)] => [ set_headers_for_list_send => [ [{ list_email => 'some-list@example.com', }] => undef, ], unsafe_get_header => [ to => 'some-list@example.com', cc => undef, ], ], ];