Email settings files plus lex string audit program spec

This commit is contained in:
2025-07-04 09:05:08 +01:00
parent dfa582e6cb
commit c700add2a6
23 changed files with 3931 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,440 @@
package SrvMngr::Controller::Emailsettings;
#
# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-06-29 08:53:20
# Remember that each route must be unique (else they just overwrite each other).
# you cannot have get and post on the same name and url.
#
#----------------------------------------------------------------------
# heading : System
# description : E-Mail
# navigation : 4000 400
#
# name : emailsettings, method : get, url : /emailsettings, ctlact : Emailsettings#main
# name : emailsettingsu, method : post, url : /emailsettingsu, ctlact : Emailsettings#do_update
# name : emailsettingsd, method : get, url : /emailsettingsd, ctlact : Emailsettings#do_display
#
# routes : end
#
# Documentation: https://wiki.contribs.org/Emailsettings
#----------------------------------------------------------------------
#
# Scheme of things:
#
# TBA!!
use strict;
use warnings;
use Mojo::Base 'Mojolicious::Controller';
use constant FALSE => 0;
use constant TRUE => 1;
use Locale::gettext;
use SrvMngr::I18N;
use SrvMngr qw(theme_list init_session);
use Data::Dumper;
use esmith::util;
use esmith::util::network;
use esmith::ConfigDB::UTF8;
use esmith::AccountsDB;
use esmith::NetworksDB::UTF8;
use esmith::HostsDB;
use esmith::DomainsDB::UTF8;
my $cdb;
my $adb;
my $ndb;
my $hdb;
my $ddb;
my %mai_data;
require '/usr/share/smanager/lib/SrvMngr/Controller/Emailsettings-Custom.pm'; #The code that is to be added by the developer
sub main {
#
# Initial entry - route is "/<whatever>"
#
#set initial panel
#for initial panel:
#Specifiy panel to enter
#load up _data hash with DB fields
#load up stash with pointer(s) to control fields hash(= get-))
#and a pointer to the prefix_data hash
#render initial panel
my $c = shift;
$c->app->log->info( $c->log_req );
#The most common ones - you might want to delete some of these if they are not used.
$cdb = esmith::ConfigDB::UTF8->open() || die("Couldn't open config db");
$adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db");
$ndb = esmith::NetworksDB->open() || die("Couldn't open Network db");
$hdb = esmith::HostsDB::UTF8->open() || die("Couldn't open Hosts db");
$ddb = esmith::DomainsDB::UTF8->open() || die("Couldn't open Domains db");
%mai_data = ();
my $title = $c->l('mai_E-Mail');
my $modul = '';
$mai_data{'trt'} = 'FRONT';
#Load any DB entries into the <prefix>_data area so as they are preset in the form
# which DB - this only really works if the initial panel is a PARAMS type panel and not a TABLE
my $db = $cdb; #pickup local or global db or Default to config
$c->do_display($mai_data{'trt'});
}
# Post request with params - submit from the form
sub do_update {
#
# Return after submit pushed on panel (this is a post) - route is "/<whatever>u"
# parameters in the params hash.
#
#load up all params into prefix_data hash:
#By panel (series of if statements - only one executed):
#call validate-PANEL() - return ret = ok or error message
#if validation not ok:
#render back to current panel with error message in stash
#otherwise:
#By panel (series of if statements - only one executed):
#do whatever is required: call perform-PANEL() - return 'ok' or Error Message
#call signal-event for any global actions specified (check it exists - error and continue?)
#if action smeserver-<whatever>-update exists
#signal_event smeserver-<whatever>-update
#call signal-event for any specific actions for thids panel (check it exists first - error and continue)
#set success in stash
#if no "nextpanel" entry:
#set firstpanel
#else
#set nextpanel
#call render
my $c = shift;
$c->app->log->info($c->log_req);
my $modul = '';
#The most common ones - you might want to delete some of these if they are not used.
$cdb = esmith::ConfigDB::UTF8->open() || die("Couldn't open config db");
$adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db");
$ndb = esmith::NetworksDB->open() || die("Couldn't open Network db");
$hdb = esmith::HostsDB::UTF8->open() || die("Couldn't open Hosts db");
$ddb = esmith::DomainsDB::UTF8->open() || die("Couldn't open Domains db");
my $title = $c->l('mai_E-Mail');
# Accessing all POST/GET parameters
my $params = $c->req->params->to_hash;
# Get number of POST parameters
#my $num_params = keys scaler %$params;
#Params are available in the hash "params" - copy to the prefix_data hash
#while (my ($key, $value) = each %{$c->req->params->to_hash}) {
# $mai_data{$key} = $value;
#}
# the value of trt will tell you which panel has returned
my $trt = $c->param('trt') || 'FRONT'; #hidden control on every form.
my $ret = 'ok';
#Validate the parameters in a custom sub one for each panel (although only one of these will be executed)
my $thispanel;
if ($trt eq 'FRONT'){
#Validate form parameters for panel FRONT
$ret = $c->validate_FRONT(\%mai_data);
$thispanel = 'FRONT';
}
if ($trt eq 'ACC'){
#Validate form parameters for panel ACC
$ret = $c->validate_ACC(\%mai_data);
$thispanel = 'ACC';
}
if ($trt eq 'FIL'){
#Validate form parameters for panel FIL
$ret = $c->validate_FIL(\%mai_data);
$thispanel = 'FIL';
}
if ($trt eq 'REC'){
#Validate form parameters for panel REC
$ret = $c->validate_REC(\%mai_data);
$thispanel = 'REC';
}
if ($trt eq 'DEL'){
#Validate form parameters for panel DEL
$ret = $c->validate_DEL(\%mai_data);
$thispanel = 'DEL';
}
if ($ret ne 'ok'){
$c->stash(error => $c->l($ret));
$c->do_display($thispanel);
} else {
#Do whatever is needed, including writing values to the DB
if ($trt eq 'FRONT'){
#do whatever is required ...
$ret = $c->perform_FRONT(\%mai_data);
if ($ret ne 'ok') {
# return to the panel with error message
$c->stash(error => $c->l($ret));
$c->stash(
title => $title,
modul => $modul,
mai_data => \%mai_data
);
$c->render(template => "emailsettings");
return
} else {
$c->stash( success => $c->l('mai_FRONT_panel_action_was_successful')); #A bit bland - edit it in the lex file
}
}
if ($trt eq 'ACC'){
#do whatever is required ...
$ret = $c->perform_ACC(\%mai_data);
if ($ret ne 'ok') {
# return to the panel with error message
$c->stash(error => $c->l($ret));
$c->stash(
title => $title,
modul => $modul,
mai_data => \%mai_data
);
$c->render(template => "emailsettings");
return
} else {
$c->stash( success => $c->l('mai_ACC_panel_action_was_successful')); #A bit bland - edit it in the lex file
}
}
if ($trt eq 'FIL'){
#do whatever is required ...
$ret = $c->perform_FIL(\%mai_data);
if ($ret ne 'ok') {
# return to the panel with error message
$c->stash(error => $c->l($ret));
$c->stash(
title => $title,
modul => $modul,
mai_data => \%mai_data
);
$c->render(template => "emailsettings");
return
} else {
$c->stash( success => $c->l('mai_FIL_panel_action_was_successful')); #A bit bland - edit it in the lex file
}
}
if ($trt eq 'REC'){
#do whatever is required ...
$ret = $c->perform_REC(\%mai_data);
if ($ret ne 'ok') {
# return to the panel with error message
$c->stash(error => $c->l($ret));
$c->stash(
title => $title,
modul => $modul,
mai_data => \%mai_data
);
$c->render(template => "emailsettings");
return
} else {
$c->stash( success => $c->l('mai_REC_panel_action_was_successful')); #A bit bland - edit it in the lex file
}
}
if ($trt eq 'DEL'){
#do whatever is required ...
$ret = $c->perform_DEL(\%mai_data);
if ($ret ne 'ok') {
# return to the panel with error message
$c->stash(error => $c->l($ret));
$c->stash(
title => $title,
modul => $modul,
mai_data => \%mai_data
);
$c->render(template => "emailsettings");
return
} else {
$c->stash( success => $c->l('mai_DEL_panel_action_was_successful')); #A bit bland - edit it in the lex file
}
}
# and call any signal-events needed
#TBD
# Setup shared data and call panel
if ('none' eq 'none') {
$mai_data{'trt'} = 'FRONT';
} else {
$mai_data{'trt'} = 'none';
}
$c->do_display($mai_data{'trt'});
}
}
sub do_display {
#
# Return after link clicked in table (this is a get) - route is "/<whatever>d"
# Expects ?trt=PANEL&selected="TableRowName" plus any other required
#
# OR it maybe a post from the main panel to add a new record
#
#load up all supplied params into prefix_data hash
#call get-selected-PANEL() - returns hash of all relevent parameters
#load up returned hash into prefix_data
#render - to called panel
my ($c,$trt) = @_;
$c->app->log->info($c->log_req);
#The most common ones - you might want to delete some of these if they are not used.
$cdb = esmith::ConfigDB::UTF8->open() || die("Couldn't open config db");
$adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db");
$ndb = esmith::NetworksDB->open() || die("Couldn't open Network db");
$hdb = esmith::HostsDB::UTF8->open() || die("Couldn't open Hosts db");
$ddb = esmith::DomainsDB::UTF8->open() || die("Couldn't open Domains db");
my $title = $c->l('mai_E-Mail');
my $modul = '';
# Accessing all parameters
my $params = $c->req->params->to_hash;
# Get number of parameters
my $num_params = keys %$params;
#Tag as Post or Get (ie. create new entry or edit existing one
my $is_new_record = ($c->req->method() eq 'POST');
#Params are available in the hash "params" - copy to the prefix_data hash
#while (my ($key, $value) = each %{$c->req->params->to_hash}) {
# $mai_data{$key} = $value;
#}
# the value of trt will tell you which panel has returned
if (! $trt){
$trt = $c->param('trt') || 'FRONT'; #Indicates where to go now
}
# Now add in the params from the selected row from the table
my %selectedrow;
if ($trt eq 'FRONT'){
#Validate Get selected row (if applicable) FRONT
%selectedrow = $c->get_selected_FRONT($mai_data{'Selected'},$is_new_record);
}
if ($trt eq 'ACC'){
#Validate Get selected row (if applicable) ACC
%selectedrow = $c->get_selected_ACC($mai_data{'Selected'},$is_new_record);
}
if ($trt eq 'FIL'){
#Validate Get selected row (if applicable) FIL
%selectedrow = $c->get_selected_FIL($mai_data{'Selected'},$is_new_record);
}
if ($trt eq 'REC'){
#Validate Get selected row (if applicable) REC
%selectedrow = $c->get_selected_REC($mai_data{'Selected'},$is_new_record);
}
if ($trt eq 'DEL'){
#Validate Get selected row (if applicable) DEL
%selectedrow = $c->get_selected_DEL($mai_data{'Selected'},$is_new_record);
}
#Copy in the selected row params to the prefix_data hash to pass to the panel
while (my ($key, $value) = each %selectedrow){
$mai_data{$key} = $value;
}
# Where to go now
$mai_data{'trt'} = $trt;
# Set up other shared data according to the panel to go to
if ($trt eq 'FRONT'){
# pickup any other contents needed and load them into hash shared with panel
my %returned_hash;
# subroutine returns a hash directly
%returned_hash = $c->get_data_for_panel_FRONT();
# Copy each key-value pair from the returned hash to the prefix data hash
while (my ($key, $value) = each %returned_hash) {
$mai_data{$key} = $value;
}
}
if ($trt eq 'ACC'){
# pickup any other contents needed and load them into hash shared with panel
my %returned_hash;
# subroutine returns a hash directly
%returned_hash = $c->get_data_for_panel_ACC();
# Copy each key-value pair from the returned hash to the prefix data hash
while (my ($key, $value) = each %returned_hash) {
$mai_data{$key} = $value;
}
}
if ($trt eq 'FIL'){
# pickup any other contents needed and load them into hash shared with panel
my %returned_hash;
# subroutine returns a hash directly
%returned_hash = $c->get_data_for_panel_FIL();
# Copy each key-value pair from the returned hash to the prefix data hash
while (my ($key, $value) = each %returned_hash) {
$mai_data{$key} = $value;
}
}
if ($trt eq 'REC'){
# pickup any other contents needed and load them into hash shared with panel
my %returned_hash;
# subroutine returns a hash directly
%returned_hash = $c->get_data_for_panel_REC();
# Copy each key-value pair from the returned hash to the prefix data hash
while (my ($key, $value) = each %returned_hash) {
$mai_data{$key} = $value;
}
}
if ($trt eq 'DEL'){
# pickup any other contents needed and load them into hash shared with panel
my %returned_hash;
# subroutine returns a hash directly
%returned_hash = $c->get_data_for_panel_DEL();
# Copy each key-value pair from the returned hash to the prefix data hash
while (my ($key, $value) = each %returned_hash) {
$mai_data{$key} = $value;
}
}
# and table control fields
# Data for panel
$c->stash(
title => $title,
modul => $modul,
mai_data => \%mai_data
);
$c->render(template => "emailsettings");
}
1;

View File

@@ -0,0 +1,56 @@
%#
%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-06-29 08:53:20
%#
<div id="Emailsettings-ACC" class="partial Emailsettings-ACC">
%# <script>
%# window.onload = function() {
%# SelectInput();
%# };
%# </script>
% if (config->{debug} == 1) {
<pre>
%= dumper $mai_data
</pre>
% }
% my $btn = l('mai_SAVE');
% $c->param(Selected => undef); #This may need deleting for a params panel - only needed for a table
%= form_for "emailsettingsu" => (method => 'POST') => begin
% param 'trt' => $mai_data->{trt} unless param 'trt';
%= hidden_field 'trt' => $mai_data->{trt}
%# Inputs etc in here.
%=l 'mai_DESC_POP_ACCESS_CONTROL'
<p><span class=label>
%=l 'mai_LABEL_POP_ACCESS_CONTROL'
</span><span class=input>
% param 'POPAccess' => $c->get_current_pop3_access() unless param 'POPAccess';
%= select_field 'POPAccess' => $c->get_pop_opt(), class => 'input'
</span></p>
%=l 'mai_DESC_IMAP_ACCESS_CONTROL'
<p><span class=label>
%=l 'mai_LABEL_IMAP_ACCESS_CONTROL'
</span><span class=input>
% param 'IMAPAccess' => $c->get_current_imap_access() unless param 'IMAPAccess';
%= select_field 'IMAPAccess' => $c->get_imap_opt(), class => 'input'
</span></p>
%=l 'mai_DESC_WEBMAIL'
<p><span class=label>
%=l 'mai_LABEL_WEBMAIL'
</span><span class=input>
% param 'WebMail' => $c->get_current_webmail_status() unless param 'WebMail';
%= select_field 'WebMail' => $c->get_webmail_opt(), class => 'input'
</span></p>
% my $btn = l('SAVE');
%= submit_button "$btn", class => 'action'
%# ....
%# Probably finally by a submit.
%= submit_button $btn, class => 'action'
%end
</div>

View File

@@ -0,0 +1,89 @@
%#
%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-06-29 08:53:20
%#
<div id="Emailsettings-DEL" class="partial Emailsettings-DEL">
%# <script>
%# window.onload = function() {
%# SelectInput();
%# };
%# </script>
% if (config->{debug} == 1) {
<pre>
%= dumper $mai_data
</pre>
% }
% my $btn = l('mai_SAVE');
% $c->param(Selected => undef); #This may need deleting for a params panel - only needed for a table
%= form_for "emailsettingsu" => (method => 'POST') => begin
% param 'trt' => $mai_data->{trt} unless param 'trt';
%= hidden_field 'trt' => $mai_data->{trt}
%# Inputs etc in here.
<h2>
%=l 'mai_TITLE_UNKNOWN'
</h2>
%=l 'mai_DESC_UNKNOWN'
<p><span class=label>
%=l 'mai_LABEL_UNKNOWN'
</span><span class=input>
% param 'EmailUnknownUser' => $mai_datas->{emailunknownuser} unless param 'EmailUnknownUser';
%= select_field 'EmailUnknownUser' => $c->get_emailunknownuser_opt(), class => 'input'
</span></p>
<!--<hr class='menubar' />-->
<h2>
%=l 'mai_TITLE_DELEGATE'
</h2>
%=l 'mai_DESC_DELEGATE'
<p><span class=label>
%=l 'mai_LABEL_DELEGATE'
</span><span class=input>
% param 'DelegateMailServer' => $mai_datas->{delegatemailserver} unless param 'DelegateMailServer';
%= text_field 'DelegateMailServer', class => 'input'
</span></p>
<!--<hr class='sectionbar' />-->
<h2>
%=l 'mai_TITLE_SMARTHOST'
</h2>
%=l 'mai_DESC_SMARTHOST'
<p><span class=label>
%=l 'mai_LABEL_SMARTHOST'
</span><span class=input>
% param 'SMTPSmartHost' => $mai_datas->{smtpsmarthost} unless param 'SMTPSmartHost';
%= text_field 'SMTPSmartHost', class => 'input'
</span></p>
<p><span class=label>
%=l 'mai_LABEL_SMARTHOST_SMTPAUTH_STATUS'
</span><span class=input>
% param 'SMTPAUTHPROXY_status' => $mai_datas->{smtpauthproxystatus} unless param 'SMTPAUTHPROXY_status';
%= select_field 'SMTPAUTHPROXY_status' => [[(l 'DISABLED') => 'disabled'], [(l 'ENABLED') => 'enabled']], class => 'input'
</span></p>
<p><span class=label>
%=l 'mai_LABEL_SMARTHOST_SMTPAUTH_USERID'
</span><span class=input>
% param 'SMTPAUTHPROXY_Userid' => $mai_datas->{smtpauthproxyuserid} unless param 'SMTPAUTHPROXY_Userid';
%= text_field 'SMTPAUTHPROXY_Userid', class => 'input'
</span></p>
<p><span class=label>
%=l 'mai_LABEL_SMARTHOST_SMTPAUTH_PASSWD'
</span><span class=input>
% param 'SMTPAUTHPROXY_Passwd' => $mai_datas->{smtpauthproxypassword} unless param 'SMTPAUTHPROXY_Passwd';
%= password_field 'SMTPAUTHPROXY_Passwd', class => 'input'
</span></p>
%# ....
%# Probably finally by a submit.
%= submit_button $btn, class => 'action'
%end
</div>

View File

@@ -0,0 +1,97 @@
%#
%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-06-29 08:53:20
%#
<div id="Emailsettings-FIL" class="partial Emailsettings-FIL">
%# <script>
%# window.onload = function() {
%# SelectInput();
%# };
%# </script>
% if (config->{debug} == 1) {
<pre>
%= dumper $mai_data
</pre>
% }
% my $btn = l('mai_SAVE');
% $c->param(Selected => undef); #This may need deleting for a params panel - only needed for a table
%= form_for "emailsettingsu" => (method => 'POST') => begin
% param 'trt' => $mai_data->{trt} unless param 'trt';
%= hidden_field 'trt' => $mai_data->{trt}
%# Inputs etc in here.
%=l 'mai_DESC_VIRUS_SCAN'
<p><span class=label>
%=l 'mai_LABEL_VIRUS_SCAN'
</span><span class=input>
% param 'VirusStatus' => $mai_datas->{virusstatus} unless param 'VirusStatus';
%= select_field 'VirusStatus' => [[(l 'DISABLED') => 'disabled'], [ (l 'ENABLED') => 'enabled']], class => 'input'
</span><br></p>
%=l 'mai_DESC_SPAM_SCAN'
<p><span class=label>
%=l 'mai_LABEL_SPAM_SCAN'
</span><span class=input>
% param 'Spamstatus' => $mai_datas->{spamstatus} unless param 'Spamstatus';
%= select_field 'Spamstatus' => [[(l 'DISABLED') => 'disabled'], [ (l 'ENABLED') => 'enabled']], class => 'input'
</span></p>
<p><span class=label>
%=l 'mai_LABEL_SPAM_SENSITIVITY'
</span><span class=input>
% param 'SpamSensitivity' => $mai_datas->{spamsensitivity} unless param 'SpamSensitivity';
%= select_field 'SpamSensitivity' => $c->get_spam_sensitivity_opt(), class => 'input'
</span></p>
<p><span class=label>
%=l 'mai_LABEL_SPAM_TAGLEVEL'
</span><span class=input>
% param 'SpamTagLevel' => $mai_datas->{spamtaglevel} unless param 'SpamTagLevel';
%= select_field 'SpamTagLevel' => $c->get_spam_level_options(), class => 'input'
</span></p>
<p><span class=label>
%=l 'mai_LABEL_SPAM_REJECTLEVEL'
</span><span class=input>
% param 'SpamRejectLevel' => $mai_datas->{spamrejectlevel} unless param 'SpamRejectLevel';
%= select_field 'SpamRejectLevel' => $c->get_spam_level_options(), class => 'input'
</span></p>
<p><span class=label>
%=l 'mai_LABEL_SORTSPAM'
</span><span class=input>
% param 'SpamSortSpam' => $mai_datas->{spamsortspam} unless param 'SpamSortSpam';
%= select_field 'SpamSortSpam' => [[(l 'DISABLED') => 'disabled'], [ (l 'ENABLED') => 'enabled']], class => 'input'
</span></p>
%=l 'mai_DESC_SPAM_SUBJECT'
<p><span class=label>
%=l 'mai_LABEL_SPAM_SUBJECTTAG'
</span><span class=input>
% param 'SpamSubjectTag' => $mai_datas->{spamsubjecttag} unless param 'SpamSubjectTag';
%= select_field 'SpamSubjectTag' => [[(l 'DISABLED') => 'disabled'], [ (l 'ENABLED') => 'enabled']], class => 'input'
</span></p>
<p><span class=label>
%=l 'mai_LABEL_SPAM_SUBJECT'
</span><span class=input>
% param 'SpamSubject' => $mai_datas->{spamsubject} unless param 'SpamSubject';
%= text_field 'SpamSubject' => class => 'input'
</span></p>
%=l 'mai_DESC_BLOCK_EXECUTABLE_CONTENT'
<p><span class=label>
%=l 'mai_LABEL_CONTENT_TO_BLOCK'
</span><span class=input>
% param 'BlockExecutableContent' => $c->get_patterns_current_opt() unless param 'BlockExecutableContent';
%= select_field 'BlockExecutableContent' => $c->get_patterns_opt(), class => 'input', multiple => "1"
</span></p>
%# ....
%# Probably finally by a submit.
%= submit_button $btn, class => 'action'
%end
</div>

View File

@@ -0,0 +1,155 @@
%#
%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-06-29 08:53:20
%#
<div id="Emailsettings-FRONT" class="partial Emailsettings-FRONT">
%# <script>
%# window.onload = function() {
%# SelectInput();
%# };
%# </script>
% if (config->{debug} == 1) {
<pre>
%= dumper $mai_data
</pre>
% }
% $c->param(Selected => undef); #This may need deleting for a params panel - only needed for a table
<h1><%= $title%></h1>
<br>
<br>
% my $btn = l('Modify');
<fieldset title='fred'>
<legend><%= $c->l('mai_DESC_STATE_ACCESS_BUTTON') %></legend>
%= form_for 'emailsettings' => (method => 'POST') => begin
<p><span class=label>
%=l 'mai_LABEL_POP_ACCESS_CONTROL'
</span><span class=data2>
%= $c->get_current_pop3_access( TRUE )
</span></p>
<p><span class=label>
%=l 'mai_LABEL_IMAP_ACCESS_CONTROL'
</span><span class=data2>
%= $c->get_current_imap_access( TRUE )
</span></p>
<p><span class=label>
%=l 'mai_LABEL_WEBMAIL'
</span><span class=data2>
%= $c->get_current_webmail_status( TRUE )
</span></p>
<br>
<div class='center'>
%= submit_button "$btn", class => 'action'
</div>
%= hidden_field 'trt' => 'ACC'
% end
</fieldset>
<br>
<fieldset>
<legend><%= $c->l('mai_DESC_STATE_FILTERING_BUTTON') %></legend>
%= form_for 'emailsettings' => (method => 'POST') => begin
<p><span class=label>
%=l 'mai_LABEL_VIRUS_SCAN'
</span><span class=data2>
%= $c->get_virus_status(TRUE)
</span></p>
<p><span class=label>
%=l 'mai_LABEL_SPAM_SCAN'
</span><span class=data2>
%= $c->get_spam_status(TRUE)
</span></p>
<p><span class=label>
%=l 'mai_LABEL_BLOCK_EXECUTABLE_CONTENT'
</span><span class=data2>
%= $c->get_patterns_status(TRUE)
</span></p>
<br>
<div class='center'>
%= submit_button "$btn", class => 'action'
</div>
%= hidden_field 'trt' => 'FIL'
% end
</fieldset>
<br>
<fieldset>
<legend><%= $c->l('mai_DESC_STATE_RECEPTION_BUTTON') %></legend>
%= form_for 'emailsettings' => (method => 'POST') => begin
<p><span class=label>
%=l 'mai_LABEL_MODE'
</span><span class=data2>
%= $mai_datas->{fetchmailmethod}
</span></p>
% my $smtp_mesg;
% $smtp_mesg=l('SMTP port %u allow client to authenticate:');
<p><span class=label>
%= sprintf($smtp_mesg,$c->get_db_prop('qpsmtpd','TCPPort',25));
</span><span class=data2>
%= $c->get_current_smtp_auth( TRUE )
</span></p>
% $smtp_mesg=l('SMTPS SSL/TLS auth: port %u status:');
<p><span class=label>
%= sprintf($smtp_mesg,$c->get_db_prop('sqpsmtpd','TCPPort',465));
</span><span class=data2>
%= $c->get_current_smtp_ssl_auth( TRUE, 's', FALSE )
</span></p>
% $smtp_mesg=l 'Submission port %u status:';
<p><span class=label>
%= sprintf($smtp_mesg,$c->get_db_prop('uqpsmtpd','TCPPort',587));
</span><span class=data2>
%= $c->get_current_smtp_ssl_auth( TRUE,'u', FALSE )
</span></p>
<br />
<div class='center'>
%= submit_button "$btn", class => 'action'
</div>
%= hidden_field 'trt' => 'REC'
% end
</fieldset>
<br>
<fieldset>
<legend><%= $c->l('mai_DESC_STATE_DELIVERY_BUTTON') %></legend>
%= form_for 'emailsettings' => (method => 'POST') => begin
<p><span class=label>
%=l 'mai_LABEL_UNKNOWN'
</span><span class=data2>
%= $c->get_emailunknownuser_status( TRUE )
</span></p>
<p><span class=label>
%=l 'mai_LABEL_DELEGATE'
</span><span class=data2>
%= $c->get_value('DelegateMailServer')
</span></p>
<p><span class=label>
%=l 'mai_LABEL_SMARTHOST'
</span><span class=data2>
%= $c->get_value('SMTPSmartHost')
</span></p>
<br>
<div class='center'>
%= submit_button "$btn", class => 'action'
</div>
%= hidden_field 'trt' => 'DEL'
% end
</fieldset>
</div>

View File

@@ -0,0 +1,158 @@
%#
%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-06-29 08:53:20
%#
<div id="Emailsettings-REC" class="partial Emailsettings-REC">
%# <script>
%# window.onload = function() {
%# SelectInput();
%# };
%# </script>
% if (config->{debug} == 1) {
<pre>
%= dumper $mai_data
</pre>
% }
% my $btn = l('mai_SAVE');
% $c->param(Selected => undef); #This may need deleting for a params panel - only needed for a table
%= form_for "emailsettingsu" => (method => 'POST') => begin
% param 'trt' => $mai_data->{trt} unless param 'trt';
%= hidden_field 'trt' => $mai_data->{trt}
%# Inputs etc in here.
%=l 'mai_DESC_MODE'
<p><span class=label>
%=l 'mai_LABEL_MODE'
</span><span class=input>
% param 'FetchmailMethod' => $mai_datas->{fetchmailmethod} unless param 'FetchmailMethod';
<!--
<pre>
%= dumper $mai_datas->{fetchmailmethod}
%= dumper $c->get_retrieval_opt()
%= param 'FetchmailMethod'
</pre>
-->
%= select_field 'FetchmailMethod' => $c->get_retrieval_opt(), class => 'input'
</span></p>
%#=l 'mai_DESC_SMTP_AUTH_CONTROL'
<br />
%= l "SMTP port (25) main purpose is to receive emails from another server, STARTTLS is always offered, but auth if offered is only if STARTTLS is also used by client."
<br />
%= l "SMTPS port (465) will require implicit SSL/TLS then authenticate to send."
<br />
%= l "SMTP Submission port (587) will require STARTTLS, then authenticate to send."
<br />
% my $smtp_mesg=l('SMTP port %u allow client to authenticate:');
<p><span class=label>
%= sprintf($smtp_mesg,$c->get_db_prop('qpsmtpd','TCPPort',25));
</span><span class=input>
% param 'SMTPAuth' => $c->get_current_smtp_auth( FALSE ) unless param 'SMTPAuth';
<!--
<pre>
%= dumper $c->get_smtp_auth_opt()
%= dumper $c->get_current_smtp_auth(FALSE)
%= dumper $c->get_db_prop("qpsmtpd","Authentication")
%= param 'SMTPAuth'
</pre>
-->
%= select_field 'SMTPAuth' => $c->get_smtp_auth_opt(), class => 'input'
</span></p>
% my $smtp_mesg=l('SMTPS SSL/TLS auth: port %u status:');
<p><span class=label>
%= sprintf($smtp_mesg,$c->get_db_prop('sqpsmtpd','TCPPort',465));
</span><span class=input>
% param 'sSMTPAuth' => $c->get_current_smtp_ssl_auth(FALSE,'s', TRUE) unless param 'sSMTPAuth';
%= select_field 'sSMTPAuth' => $c->get_smtp_ssl_auth_opt(), class => 'input'
</span></p>
%my $smtp_mesg=l('Submission port %u status:');
<p><span class=label>
%= sprintf($smtp_mesg,$c->get_db_prop('uqpsmtpd','TCPPort',587));
</span><span class=input>
% param 'uSMTPAuth' => $c->get_current_smtp_ssl_auth(FALSE,'u', TRUE) unless param 'uSMTPAuth';
<!--
<pre>
%= dumper $c->get_smtp_ssl_auth_opt()
%= dumper $c->get_current_smtp_ssl_auth(FALSE,'s', TRUE)
%= dumper $c->get_current_smtp_ssl_auth(FALSE,'u', TRUE)
%= dumper $c->get_db_prop("uqpsmtpd","access")
%= param 'uSMTPAuth'
</pre>
-->
%= select_field 'uSMTPAuth' => $c->get_smtp_ssl_auth_opt(), class => 'input'
</span></p>
<!--<hr class="sectionbar" />-->
<h2>
%=l 'mai_TITLE_SECONDARY'
</h2>
%=l 'mai_DESC_SECONDARY'
<p><span class=label>
%=l 'mai_LABEL_SECONDARY'
</span><span class=input>
% param 'SecondaryMailServer' => $mai_datas->{secondarymailserver} unless param 'SecondaryMailServer';
%= text_field 'SecondaryMailServer', class => 'input'
</span></p>
%=l 'mai_DESC_FETCH_PERIOD'
<p><span class=label>
%=l 'mai_LABEL_FETCH_PERIOD'
</span><span class=input>
% param 'FreqOffice' => $mai_datas->{freqoffice} unless param 'FreqOffice';
%= select_field 'FreqOffice' => $c->fetchmail_freq(), class => 'input'
</span></p>
<p><span class=label>
%=l 'mai_LABEL_FETCH_PERIOD_NIGHTS'
</span><span class=input>
% param 'FreqOutside' => $mai_datas->{freqoutside} unless param 'FreqOutside';
%= select_field 'FreqOutside' => $c->fetchmail_freq(), class => 'input'
</span></p>
<p><span class=label>
%=l 'mai_LABEL_FETCH_PERIOD_WEEKENDS'
</span><span class=input>
% param 'FreqWeekend' => $mai_datas->{freqweekend} unless param 'FreqWeekend';
%= select_field 'FreqWeekend' => $c->fetchmail_freq(), class => 'input'
</span></p>
<p><span class=label>
%=l 'mai_LABEL_POP_ACCOUNT'
</span><span class=input>
% param 'SecondaryMailAccount' => $mai_datas->{secondarymailaccount} unless param 'SecondaryMailAccount';
%= text_field 'SecondaryMailAccount', class => 'input'
</span></p>
<p><span class=label>
%=l 'mai_LABEL_POP_PASS'
</span><span class=input>
% param 'SecondaryMailPassword' => $mai_datas->{secondarymailpassword} unless param 'SecondaryMailPassword';
%= password_field 'SecondaryMailPassword', class => 'input'
</span></p>
<p><span class=label>
%=l 'mai_LABEL_SORT_METHOD'
</span><span class=input>
% param 'SpecifyHeader' => $mai_datas->{specifyheader} unless param 'SpecifyHeader';
%= select_field 'SpecifyHeader' => [[(l 'mai_DEFAULT') => 'off'], [(l 'mai_SPECIFY_BELOW') => 'on']], class => 'input'
</span></p>
<p><span class=label>
%=l 'mai_LABEL_SORT_HEADER'
</span><span class=input>
% param 'SecondaryMailEnvelope' => $mai_datas->{secondarymailenvelope} unless param 'SecondaryMailEnvelope';
%= text_field 'SecondaryMailEnvelope', class => 'input'
</span></p>
%# ....
%# Probably finally by a submit.
%= submit_button $btn, class => 'action'
%end
</div>

View File

@@ -0,0 +1,14 @@
/*
Generated by: SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-06-29 08:53:20
*/
.Emailsettings-panel {}
.name {}
.rout {}
.name {}
.rout {}
.name {}
.rout {}
.name {}
.rout {}
.name {}
.rout {}

View File

@@ -0,0 +1,68 @@
%#
%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-06-29 08:53:20
%#
% layout 'default', title => "Sme server 2 - E-Mail", share_dir => './';
%# css specific to this panel:
% content_for 'module' => begin
%= stylesheet '/css/emailsettings.css'
%= javascript '/js/emailsettings.js'
<div id="module" class="module Emailsettings-panel">
% if (config->{debug} == 1) {
<pre>
%= dumper $c->current_route
%= dumper $mai_data->{trt}
</pre>
% }
<h1><%=$title%></h1>
% if ( stash('modul')) {
%= $c->render_to_string(inline => stash('modul') );
% }
%if ($c->stash('first')) {
<br><p>
%=$c->render_to_string(inline =>$c->l($c->stash('first')))
</p>
%} elsif ($c->stash('success')) {
<div class='success '>
%= $c->l($c->stash('success'));
</div>
<br />
%} elsif ($c->stash('error')) {
<div class='sme-error'>
%= $c->l($c->stash('error'));
</div>
<br />
%}
%#Routing to partials according to trt parameter.
%#This ought to be cascading if/then/elsif, but is easier to just stack the if/then's rather like a case statement'
% if ($mai_data->{trt} eq "FRONT") {
%= include 'partials/_mai_FRONT'
%}
% if ($mai_data->{trt} eq "ACC") {
%= include 'partials/_mai_ACC'
%}
% if ($mai_data->{trt} eq "FIL") {
%= include 'partials/_mai_FIL'
%}
% if ($mai_data->{trt} eq "REC") {
%= include 'partials/_mai_REC'
%}
% if ($mai_data->{trt} eq "DEL") {
%= include 'partials/_mai_DEL'
%}
</div>
%end

View File

@@ -0,0 +1,5 @@
//
//Generated by: SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-06-29 08:53:20
//
$(document).ready(function() {
});

View File

@@ -0,0 +1,152 @@
'mai_FORM_TITLE' => 'E-mail settings',
'E-mail' => 'E-mail',
'mai_SUCCESS' => 'The new e-mail settings have been saved.',
'mai_NEVER' => 'not at all',
'mai_EVERY5MIN' => 'Every 5 minutes',
'mai_EVERY15MIN' => 'Every 15 minutes',
'mai_EVERY30MIN' => 'Every 30 minutes',
'mai_EVERYHOUR' => 'Every hour',
'mai_EVERY2HRS' => 'Every 2 hours',
'mai_STANDARD' => 'Standard (SMTP)',
'mai_ETRN' => 'ETRN (SMTP with client request)',
'mai_DEFAULT' => 'Default',
'mai_SPECIFY_BELOW' => 'Specify below',
'mai_MULTIDROP' => 'multi-drop',
'mai_LABEL_MODE' => 'E-mail retrieval mode',
'mai_DESC_MODE' => 'The e-mail retrieval mode can be set to
standard (for dedicated Internet connections), ETRN (recommended
for dialup connections), or multi-drop (for dialup connections if
ETRN is not supported by your Internet provider). Note that
multi-drop mode is the only option available when the server is
configured in private server and gateway mode.',
'mai_LABEL_DELEGATE' => 'Address of internal mail server',
'mai_TITLE_DELEGATE' => 'Delegate mail servers',
'mai_DESC_DELEGATE' => 'Your server includes a complete, full-featured e-mail server. However,
if for some reason you wish to delegate e-mail processing to
another system, specify the IP address of the delegate system
here. For normal operation, leave this field blank.',
'mai_LABEL_SECONDARY' => 'Secondary mail server',
'mai_TITLE_SECONDARY' => 'ETRN or multi-drop settings',
'mai_DESC_SECONDARY' => 'For ETRN or multi-drop, specify the hostname or IP address of your
secondary mail server. (If using the standard e-mail setup, this
field can be left blank.)',
'mai_DESC_FETCH_PERIOD' => 'For ETRN or multi-drop, you can control how frequently this server
contacts your secondary e-mail server to fetch e-mail. More
frequent connections mean that you receive your e-mail more
quickly, but also cause Internet requests to be sent more often,
possibly increasing your phone and Internet charges.',
'mai_LABEL_FETCH_PERIOD' => 'During office hours (8:00 AM to 6:00 PM) on weekdays',
'mai_LABEL_FETCH_PERIOD_NIGHTS' => 'Outside office hours (6:00 PM to 8:00 AM) on weekdays',
'mai_LABEL_FETCH_PERIOD_WEEKENDS' => 'During the weekend',
'mai_DESC_POP_ACCOUNT' => 'For multi-drop e-mail, specify the POP user account and password.
(If using standard or ETRN e-mail, these fields can be blank.)
Also, for multi-drop, you can either use the default mail sorting
method, or you can specify a particular message header to use for
mail sorting.',
'mai_LABEL_POP_PASS' => 'POP user password (for multi-drop)',
'mai_LABEL_POP_ACCOUNT' => 'POP user account (for multi-drop)',
'mai_LABEL_SORT_METHOD' => 'Select sort method (for multi-drop)',
'mai_LABEL_SORT_HEADER' => 'Select sort header (for multi-drop)',
'mai_LABEL_FETCH_PROTO' => 'Protocol (for multi-drop)',
'mai_LABEL_FETCH_SECURE' => 'Tunnel over SSL (for multi-drop)',
'mai_AUTO' => 'Automatic',
'mai_ENABLED_BOTH' => 'Allow both HTTP and HTTPS',
'mai_ENABLED_SECURE_ONLY' => 'Allow HTTPS (secure)',
'mai_ONLY_LOCAL_NETWORK_SSL' => 'Allow HTTPS (secure) from local networks',
'mai_INSECURE_POP3' => 'Allow both POP3 and POP3S',
'mai_ALLOW_PRIVATE' => 'Allow private',
'mai_SECURE_POP3' => 'Allow private and public (secure POP3S)',
'mai_INSECURE_IMAP' => 'Allow both IMAP and IMAPS',
'mai_SECURE_IMAP' => 'Allow private and public (secure IMAPS)',
'mai_INSECURE_SMTP' => 'Allow both SMTP and SSMTP',
'mai_SECURE_SMTP' => 'Allow SSMTP (secure)',
'mai_LABEL_POP_ACCESS_CONTROL' => 'POP3 server access',
'mai_LABEL_IMAP_ACCESS_CONTROL' => 'IMAP server access',
'mai_LABEL_SMTP_AUTH_CONTROL' => 'SMTP authentication',
'mai_FORWARD_TO_ADMIN' => 'Send to administrator',
'mai_FORWARD_TO' => 'Send to',
'mai_RETURN_TO_SENDER' => 'Reject',
'mai_LABEL_UNKNOWN' => 'E-mail to unknown users',
'mai_TITLE_UNKNOWN' => 'Unknown Users',
'mai_DESC_UNKNOWN' => 'Selecting Reject (recommended setting) will configure the server to only
accept mail for valid email addresses (for example users, groups, pseudonyms).
Mail for other addresses will be rejected.',
'mai_LABEL_SMARTHOST' => 'Address of Internet provider\'s mail server',
'mai_TITLE_SMARTHOST' => 'SMTP server',
'mai_DESC_SMARTHOST' => 'The server can deliver outgoing messages directly to their
destination (recommended in most cases) or can deliver them via
your Internet provider\'s SMTP server (recommended if you have an
unreliable Internet connection or are using a residential Internet
service). If using your Internet provider\'s SMTP server, specify
its hostname or IP address below. Otherwise leave this field blank.',
'mai_INVALID_SMARTHOST' => 'The smarthost name you entered is not a valid internet domain name and is not blank',
'mai_INVALID_DELEGATE' => 'The delegate host name you entered is not a valid internet domain name and is not blank',
'mai_DESC_POP_ACCESS_CONTROL' => 'You can control POP3 server access. The setting \'Allow access
only from local networks\' allows POP3 access only from your
local network(s). The POP3S setting can be used to provide
encrypted external access to your POP3 server. We recommend
leaving this setting \'Allow access only from local networks\'
unless you have a specific reason to do otherwise.',
'mai_DESC_IMAP_ACCESS_CONTROL' => 'You can control IMAP server access. The setting \'Allow access
only from local networks\' allows IMAP access only from your
local network(s). The IMAPS setting can be used to provide
encrypted external access to your IMAP server. We recommend
leaving this setting \'Allow access only from local networks\'
unless you have a specific reason to do otherwise.',
'mai_DESC_SMTP_AUTH_CONTROL' => 'You can provide authenticated access to your SMTP server, or
set it to Disabled.
The SSMTP setting requires <b>all</b> users to use SSL/TLS
authentication. The SMTP and SSMTP option additionally allows
STARTTLS to be used to ensure secure authentication.',
'mai_DESC_WEBMAIL' => 'You can enable or disable webmail on this system. Webmail allows
users to access their mail through a regular web browser by
pointing the browser to https://[_1]/webmail,and
logging in to their account.',
'mai_LABEL_WEBMAIL' => 'Webmail access',
'mai_LABEL_BLOCK_EXECUTABLE_CONTENT' => 'Executable content blocking',
'mai_LABEL_CONTENT_TO_BLOCK' => 'Content to block',
'mai_DESC_BLOCK_EXECUTABLE_CONTENT' => 'You can block executable content in e-mail attachments
by highlighting the executable attachment types you wish to
block. E-mail containing these attachment types will
be automatically returned to the sender.',
'mai_UNACCEPTABLE_CHARS' => 'This field requires a valid e-mail address, which must include
the @ symbol and a domain name.',
'mai_DESC_STATE_ACCESS' => 'E-mail access',
'mai_DESC_STATE_ACCESS_BUTTON' => 'Change e-mail access settings',
'mai_DESC_STATE_RECEPTION' => 'E-mail reception',
'mai_DESC_STATE_RECEPTION_BUTTON' => 'Change e-mail reception settings',
'mai_DESC_STATE_DELIVERY' => 'E-mail delivery',
'mai_DESC_STATE_DELIVERY_BUTTON' => 'Change e-mail delivery settings',
'mai_DESC_STATE_FILTERING_BUTTON' => 'Change e-mail filtering settings',
'mai_LABEL_VIRUS_SCAN' => 'Virus scanning',
'mai_DESC_VIRUS_SCAN' => 'You can scan incoming and outgoing e-mail for viruses. If scanning is enabled and a virus is detected, the e-mail will be rejected and returned to the
sender.',
'mai_LABEL_SPAM_SCAN' => 'Spam filtering',
'mai_DESC_SPAM_SCAN' => 'You can scan e-mail for spam. If Spam filtering is
enabled, an X-Spam-Status: header is added to each
message, which can be used for filtering spam.
You can adjust the sensitivity of the Spam detection
process from the default of medium. For fine-grained
control, you can set the Spam sensitivity to Custom
and then choose a custom tagging level, and
optionally a level at which to reject the message.',
'mai_LABEL_SPAM_SUBJECT' => 'SPAM subject prefix',
'mai_DESC_SPAM_SUBJECT' => 'You can enable to add a tag to the subject of each
message that is classified as SPAM.
The value for this tag can be defined below.',
'mai_LABEL_SPAM_SENSITIVITY' => 'Spam sensitivity',
'mai_LABEL_SPAM_TAGLEVEL' => 'Custom spam tagging level',
'mai_LABEL_SPAM_REJECTLEVEL' => 'Custom spam rejection level',
'mai_LABEL_SPAM_SUBJECTTAG' => 'Modify subject of spam messages',
'mai_LABEL_SORTSPAM' => 'Sort spam into junkmail folder',
'mai_VERYHIGH' => 'Very high',
'mai_HIGH' => 'High',
'mai_MEDIUM' => 'Medium',
'mai_LOW' => 'Low',
'mai_VERYLOW' => 'Very low',
'mai_CUSTOM' => 'Custom',
'mai_LABEL_SMARTHOST_SMTPAUTH_STATUS' => 'SMTP Authentication for Internet provider',
'mai_LABEL_SMARTHOST_SMTPAUTH_USERID' => 'Mail server user id',
'mai_LABEL_SMARTHOST_SMTPAUTH_PASSWD' => 'Mail server password',
'mai_VALIDATION_SMTPAUTH_NONBLANK' => 'This field cannot be left blank if SMTP Authentication is
enabled.',