BCC mapping page

This commit is contained in:
Jamie Cameron 2007-12-26 21:16:58 +00:00
parent 4e133f79ba
commit a55ba7798d
11 changed files with 101 additions and 4 deletions

View File

@ -48,3 +48,5 @@ Maps in MySQL and LDAP databases can be viewed and edited in the same way that t
Fixed a bug that prevented comments and manual map editing, and added back support for PCRE and BTREE maps.
Added a button for manually editing the aliases file.
Added more SMTP relaying restrictions.
---- Changes since 1.390 ----
Outgoing email from selected addresses and domains can now be BCCd automatically using the new BCC Mapping page.

View File

@ -2,6 +2,7 @@
require 'postfix-lib.pl';
@acl_pages = ("resource", "address_rewriting", "aliases", "general",
"canonical", "virtual", "transport", "relocated", "header","body",
"bcc",
"local_delivery", "smtpd", "sasl","smtp", "rate", "debug", "ldap",
"master", "startstop", "mailq", "postfinger", "manual");

38
postfix/bcc.cgi Executable file
View File

@ -0,0 +1,38 @@
#!/usr/local/bin/perl
require './postfix-lib.pl';
$access{'bcc'} || &error($text{'bcc_ecannot'});
&ui_print_header(undef, $text{'bcc_title'}, "", "bcc");
# alias general options
print "<form action=save_opts_bcc.cgi>\n";
print "<table border width=100%>\n";
print "<tr $tb> <td><b>$text{'bcc_title'}</b></td></tr>\n";
print "<tr $cb> <td><table width=100%>\n";
$none = $text{'opts_none'};
print "<tr>\n";
&option_mapfield("sender_bcc_maps", 60, $none);
print "</tr>\n";
print "</table></td></tr></table><p>\n";
print "<input type=submit value=\"$text{'opts_save'}\"></form>\n";
print "<hr>\n";
print "<br>\n";
if (&get_current_value("sender_bcc_maps") eq "")
{
print ($text{'no_map'}."<br><br>");
}
else
{
&generate_map_edit("sender_bcc_maps", $text{'map_click'}." ".
"<font size=\"-1\">".&hlink("$text{'help_map_format'}", "virtual")."</font>\n<br>\n");
}
&ui_print_footer("", $text{'index_return'});

View File

@ -28,3 +28,4 @@ master=1
manual=1
dir=/
sasl=1
bcc=1

13
postfix/help/bcc.html Normal file
View File

@ -0,0 +1,13 @@
<header>BCC Mapping</header>
This table allows you to have outgoing email sent via your Postfix server
automatically BCCd to another email address. Typically this is used to logging
to contents of all outgoing messages, or for bandwidth accounting. <p>
Each entry in the map has a sender's email address on the left-hand side, and
an address to BCC to on the right. Alternately, the left-hand part can be a
domain name prefixed by <tt>@</tt>, such as <tt>@example.com</tt>, which will
match all sender addresses in that domain. <p>
<footer>

BIN
postfix/images/bcc.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -94,7 +94,7 @@ if ($config{'index_check'} && ($err = &check_postfix())) {
exit;
}
@onames = ( "general", "address_rewriting", "aliases", "canonical", "virtual", "transport", "relocated", "header", "body",
@onames = ( "general", "address_rewriting", "aliases", "canonical", "virtual", "transport", "relocated", "header", "body", "bcc",
"local_delivery", "resource",
"smtpd", "smtp", "sasl",
"rate", "debug", $postfix_version > 2 ? ( ) : ( "ldap" ),

View File

@ -433,6 +433,7 @@ acl_boxes=Can read users' email?
acl_postfinger=Can check postfix configuration?
acl_manual=Can edit config file?
acl_dir=Allowed directory for map files
acl_bcc=Can edit BCC mapping?
boxes_title=User Mailboxes
boxes_user=User
@ -694,7 +695,8 @@ log_misc=Changed general options
log_opts=Changed address rewriting and masquerading
log_aliases=Changed aliases options
log_canonical=Changing canonical mapping options
log_virtual=Change virtual domain options
log_virtual=Changed virtual domain options
log_bcc=Changed BCC map options
log_transport=Changed transport mapping options
log_relocated=Changed relocate mapping options
log_header=Changed header check options
@ -859,3 +861,7 @@ ldap_edelete=LDAP delete of $1 failed : $2
ldap_equery=LDAP search of $1 failed : $2
ldap_erename=LDAP rename of $1 to $2 failed : $3
ldap_emodify=LDAP modify of $1 failed : $2
bcc_title=BCC Mapping
bcc_ecannot=You are not allowed to edit BCC mappings
opts_sender_bcc_maps=BCC mapping lookup tables

View File

@ -16,8 +16,8 @@ print &ui_hidden("mapname", $in{'mapname'});
$i = 0;
foreach $tv (@maps) {
print &ui_hidden_table_start(&text('chooser_header', $i+1),
"width=100%", 2, "section$i", $tv->[0],
[ "width=30%" ]);
"width=100%", 2, "section$i",
$tv->[0] || $i == 0, [ "width=30%" ]);
# Work out type
$t = $tv->[0] eq "" ? "" :

View File

@ -628,6 +628,12 @@ sub regenerate_virtual_table
&regenerate_any_table($virtual_maps);
}
# regenerate_bcc_table()
sub regenerate_bcc_table
{
&regenerate_any_table("sender_bcc_maps");
}
# regenerate_header_table()
sub regenerate_header_table
{
@ -1581,6 +1587,7 @@ elsif ($map_name =~ /virtual/) { &redirect("virtual.cgi"); }
elsif ($map_name =~ /relocated/) { &redirect("relocated.cgi"); }
elsif ($map_name =~ /header/) { &redirect("header.cgi"); }
elsif ($map_name =~ /body/) { &redirect("body.cgi"); }
elsif ($map_name =~ /sender_bcc/) { &redirect("bcc.cgi"); }
elsif ($map_name =~ /sender_access/) { &redirect("edit_access.cgi?name=smtpd_client_restrictions:check_sender_access&title=Check+sender+access+mapping+table"); }
else { &redirect(""); }
}
@ -1593,6 +1600,7 @@ if ($map_name =~ /relocated/) { &regenerate_relocated_table(); }
if ($map_name =~ /virtual/) { &regenerate_virtual_table(); }
if ($map_name =~ /transport/) { &regenerate_transport_table(); }
if ($map_name =~ /sender_access/) { &regenerate_any_table($map_name); }
if ($map_name =~ /sender_bcc/) { &regenerate_bcc_table(); }
}
# mailq_table(&qfiles)

28
postfix/save_opts_bcc.cgi Executable file
View File

@ -0,0 +1,28 @@
#!/usr/local/bin/perl
require './postfix-lib.pl';
&ReadParse();
$access{'bcc'} || &error($text{'bcc_ecannot'});
&error_setup($text{'opts_err'});
&lock_postfix_files();
&before_save();
&save_options(\%in);
&ensure_map("sender_bcc_maps");
&after_save();
&unlock_postfix_files();
&regenerate_bcc_table();
&reload_postfix();
&webmin_log("bcc");
&redirect("");