mirror of
https://github.com/postfixadmin/postfixadmin.git
synced 2026-11-20 23:43:26 +03:00
re-creating branch after more updates on trunk
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/branches/postfixadmin-2.3beta@536 a1433add-5e2c-0410-b055-b7f2511e0802
This commit is contained in:
commit
07b82d2ead
5 files changed
+113
-16
No files matched your search
@@ -101,21 +101,22 @@ Execute "postfix reload" to complete the change.
|
||||
-------------------
|
||||
|
||||
The database table should have already been created for you, by running
|
||||
the 'upgrade.php' script.
|
||||
the 'upgrade.php' script when installing Postfixadmin.
|
||||
|
||||
If security is an issue for you, read ../DOCUMENTS/Security.txt
|
||||
|
||||
6. Edit filter.pl
|
||||
6. Edit vacation.pl
|
||||
-----------------
|
||||
|
||||
The perl filter.pl script needs minor modification to know which database
|
||||
The perl vacation.pl script needs minor modification to know which database
|
||||
you are using, and also how to connect to the database.
|
||||
|
||||
Namely :
|
||||
|
||||
Change any variables starting with '$db_' and '$db_type' to either 'mysql' or 'pgsql'.
|
||||
|
||||
|
||||
Change the $vacation_domain variable to match what you entered in your /etc/postfix/transport
|
||||
file.
|
||||
|
||||
What do these files do?
|
||||
-----------------------
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
Return-Path: <david@example.org>
|
||||
X-Original-To: david@example.org
|
||||
Delivered-To: david@example.org
|
||||
Received: by mail.palepurple.co.uk (Postfix, from userid 1007)
|
||||
id 83AE0894CF8; Tue, 5 Aug 2008 20:15:53 +0100 (BST)
|
||||
Received: from localhost (localhost [127.0.0.1])
|
||||
by mail.palepurple.co.uk (Postfix) with ESMTP id 4A249894CF9
|
||||
for <david@example.org>; Tue, 5 Aug 2008 20:15:53 +0100 (BST)
|
||||
X-Virus-Scanned: by Amavis+SpamAssassin+ClamAV and more at palepurple.co.uk
|
||||
X-Spam-Score: -2.836
|
||||
X-Spam-Level:
|
||||
X-Spam-Status: No, score=-2.836 tagged_above=-99 required=5 tests=[AWL=-0.237,
|
||||
BAYES_00=-2.599]
|
||||
Received: from mail.palepurple.co.uk ([127.0.0.50])
|
||||
by localhost (oak.palepurple.co.uk [127.0.0.50]) (amavisd-new, port 10024)
|
||||
with ESMTP id gHB1TKpjKIKX for <david@example.org>;
|
||||
Tue, 5 Aug 2008 20:15:50 +0100 (BST)
|
||||
Received: from irc.palepurple.co.uk (irc.palepurple.co.uk [89.16.169.131])
|
||||
by mail.palepurple.co.uk (Postfix) with ESMTP id CAF82894CF8
|
||||
for <david@example.org>; Tue, 5 Aug 2008 20:15:50 +0100 (BST)
|
||||
Received: by irc.palepurple.co.uk (Postfix, from userid 1000)
|
||||
id 8869450146; Tue, 5 Aug 2008 20:15:50 +0100 (BST)
|
||||
Date: Tue, 5 Aug 2008 20:15:50 +0100
|
||||
From: David Goodwin <david@example.org>
|
||||
To: david@example.org, fred@example.org, barney@example.org, rover@example.org,
|
||||
roger@example.org
|
||||
Subject: test email
|
||||
Message-ID: <20080805191549.GA27905@codepoets.co.uk>
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=us-ascii
|
||||
Content-Disposition: inline
|
||||
X-GnuPG-Key-URL: http://codepoets.co.uk/files/pubkey.txt
|
||||
X-PGP-Key: 0x117957A6
|
||||
User-Agent: Mutt/1.5.13 (2006-08-11)
|
||||
Content-Length: 136
|
||||
Lines: 7
|
||||
|
||||
hello world; this is in plain text only.
|
||||
|
||||
--
|
||||
David Goodwin
|
||||
|
||||
[ http://www.codepoets.co.uk ]
|
||||
@@ -0,0 +1,21 @@
|
||||
X-Original-To: david@example.org
|
||||
Delivered-To: david@example.org
|
||||
X-Virus-Scanned: amavisd-new at mx.ro
|
||||
From: "Teodor Iacob" <david@example.org>
|
||||
To: <david@example.org>
|
||||
Subject: estsgf
|
||||
Date: Mon, 19 Jan 2009 14:49:17 +0200
|
||||
X-Mailer: Microsoft Office Outlook 11
|
||||
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
|
||||
Thread-Index: Acl6NFZyC+AImZ1WQSS0cPUO/Y2FqA==
|
||||
X-BRO-MailScanner-Information: Please contact the ISP for more information
|
||||
X-BRO-MailScanner-ID: n0JCoUwB014357
|
||||
X-BRO-MailScanner: Found to be clean
|
||||
X-MailScanner-From: david@example.org
|
||||
X-BRO-MailScanner-Watermark: 1232974231.00027@11VRmWFJ18WRflEdvrILlQ
|
||||
|
||||
dsgsgfsgfg
|
||||
|
||||
--
|
||||
|
||||
Teodor Iacob
|
||||
@@ -14,6 +14,7 @@ export PGUSER=dg
|
||||
export PGDATABASE=postfix
|
||||
export PGHOST=pgsqlserver
|
||||
|
||||
|
||||
echo "DELETE FROM vacation WHERE email = 'david@example.org'" | psql
|
||||
|
||||
# First time around, there should be no vacation record for david@example.org, so these should all not cause mail to be sent.
|
||||
@@ -21,15 +22,29 @@ echo "DELETE FROM vacation WHERE email = 'david@example.org'" | psql
|
||||
echo
|
||||
echo "NONE OF THESE SHOULD RESULT IN MAIL BEING SENT"
|
||||
echo
|
||||
cat mailing-list.txt | perl ../vacation.pl -t yes -f fw-general-return-20540-david=example.org@lists.zend.com -- david\#example.org@autoreply.example.org
|
||||
cat test-email.txt | perl ../vacation.pl -t yes -f david1@example.org -- david\#example.org@autoreply.example.org
|
||||
cat spam.txt | perl ../vacation.pl -t yes -f mary@ccr.org -- david\#example.org@autoreply.example.org
|
||||
cat asterisk-email.txt | perl ../vacation.pl -t yes -f www-data@palepurple.net -- david\#example.org@autoreply.example.org
|
||||
cat facebook.txt | perl ../vacation.pl -t yes -f notification+meynbxsa@facebookmail.com -- david\#example.org@autoreply.example.org
|
||||
cat mail-myself.txt | perl ../vacation.pl -t yes -f david@example.org -- david\#example.org@autoreply.example.org
|
||||
|
||||
#echo "On: mailing-list.txt:"
|
||||
# cat mailing-list.txt | perl ../vacation.pl -t yes -f fw-general-return-20540-david=example.org@lists.zend.com -- david\#example.org@autoreply.example.org
|
||||
echo "On: test-email.txt:"
|
||||
cat test-email.txt | perl ../vacation.pl -t yes -f david1@example.org -- david\#example.org@autoreply.example.org
|
||||
echo "On: spam.txt:"
|
||||
cat spam.txt | perl ../vacation.pl -t yes -f mary@ccr.org -- david\#example.org@autoreply.example.org
|
||||
echo "On: asterisk-email.txt:"
|
||||
cat asterisk-email.txt | perl ../vacation.pl -t yes -f www-data@palepurple.net -- david\#example.org@autoreply.example.org
|
||||
# do not reply to facebook
|
||||
echo "On: facebook.txt:"
|
||||
cat facebook.txt | perl ../vacation.pl -t yes -f notification+meynbxsa@facebookmail.com -- david\#example.org@autoreply.example.org
|
||||
# do not send yourself a vacation notice.
|
||||
echo "On: mail-myself.txt:"
|
||||
cat mail-myself.txt | perl ../vacation.pl -t yes -f david@example.org -- david\#example.org@autoreply.example.org
|
||||
# do not send yourself a vacation notice.
|
||||
echo "On: teodor-smtp-envelope-headers.txt:"
|
||||
cat teodor-smtp-envelope-headers.txt | perl ../vacation.pl -t yes -f david@example.org -- david\#example.org@autoreply.example.org
|
||||
|
||||
|
||||
echo "INSERT INTO vacation (email, subject, body, created, active, domain) VALUES ('david@example.org', 'I am on holiday', 'Yeah, that is right', NOW(), true, 'example.org')" | psql
|
||||
|
||||
|
||||
echo
|
||||
echo "VACATION TURNED ON "
|
||||
echo
|
||||
@@ -46,4 +61,3 @@ cat facebook.txt | perl ../vacation.pl -t yes -f notification+meynbxsa@facebookm
|
||||
echo " * Mailing myself - should not send vacation message"
|
||||
cat mail-myself.txt | perl ../vacation.pl -t yes -f david@example.org -- david\#example.org@autoreply.example.org
|
||||
echo
|
||||
echo
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/perl -w
|
||||
#
|
||||
# Virtual Vacation 4.0
|
||||
# $Revision$
|
||||
# Originally by Mischa Peters <mischa at high5 dot net>
|
||||
#
|
||||
# Copyright (c) 2002 - 2005 High5!
|
||||
@@ -152,6 +153,7 @@ use Log::Log4perl qw(get_logger :levels);
|
||||
my ($from, $to, $cc, $replyto , $subject, $messageid, $lastheader, $smtp_sender, $smtp_recipient, %opts, $spam, $test_mode, $logger);
|
||||
|
||||
$subject='';
|
||||
$messageid='unknown';
|
||||
|
||||
# Setup a logger...
|
||||
#
|
||||
@@ -391,7 +393,7 @@ sub send_vacation_email {
|
||||
'Message' => encode_base64($body)
|
||||
);
|
||||
if($test_mode == 1) {
|
||||
$logger->info("** TEST MODE ** : Vacation response sent to $to from $from subject $subject - NOT sent\n");
|
||||
$logger->info("** TEST MODE ** : Vacation response sent to $to from $from subject $subject (not) sent\n");
|
||||
$logger->info(%mail);
|
||||
return 0;
|
||||
}
|
||||
@@ -410,13 +412,28 @@ sub strip_address {
|
||||
}
|
||||
my @ok;
|
||||
$logger = get_logger();
|
||||
for (split(/,\s*/, lc($arg))) {
|
||||
my $temp = Email::Valid->address($_);
|
||||
my @list;
|
||||
@list = $arg =~ m/([\w\.\-\']+\@[\w\.\-]+\w+)/g;
|
||||
foreach(@list) {
|
||||
#$logger->debug("Checking: $_");
|
||||
my $temp = Email::Valid->address( -address => $_, -mxcheck => 0);
|
||||
if($temp) {
|
||||
push(@ok, $temp);
|
||||
}
|
||||
else {
|
||||
$logger->debug("Email not valid : $Email::Valid::Details");
|
||||
}
|
||||
}
|
||||
my $result = join(", ", @ok);
|
||||
# remove duplicates
|
||||
my %seen = ();
|
||||
my @uniq;
|
||||
my $item;
|
||||
foreach $item (@ok) {
|
||||
push(@uniq, $item) unless $seen{$item}++
|
||||
}
|
||||
|
||||
my $result = join(", ", @uniq);
|
||||
#$logger->debug("Result: $result");
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -459,6 +476,7 @@ sub check_and_clean_from_address {
|
||||
$cc = '';
|
||||
$replyto = '';
|
||||
|
||||
$logger->debug("Script argument SMTP recipient is : '$smtp_recipient' and smtp_sender : '$smtp_sender'");
|
||||
while (<STDIN>) {
|
||||
last if (/^$/);
|
||||
if (/^\s+(.*)/ and $lastheader) { $$lastheader .= " $1"; next; }
|
||||
@@ -495,7 +513,7 @@ if(!$from || !$to || !$messageid || !$smtp_sender || !$smtp_recipient) {
|
||||
$logger->info("One of from=$from, to=$to, messageid=$messageid, smtp sender=$smtp_sender, smtp recipient=$smtp_recipient empty");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
$logger->debug("Email headers have to: '$to' and From: '$from'");
|
||||
$to = strip_address($to);
|
||||
$from = lc ($from);
|
||||
$from = check_and_clean_from_address($from);
|
||||
|
||||
Reference in new issue
Block a user