initial commit of file from CVS for smeserver-expire-accounts on Sat Sep 7 19:52:48 AEST 2024
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
{
|
||||
|
||||
use esmith::AccountsDB;
|
||||
use esmith::I18N;
|
||||
use Locale::gettext;
|
||||
use MIME::Lite;
|
||||
|
||||
my $i18n = new esmith::I18N;
|
||||
$i18n->setLocale('lockAutoReply.tmpl');
|
||||
|
||||
die "USERNAME not set" unless defined ($USERNAME);
|
||||
|
||||
$a = esmith::AccountsDB->open_ro or die "Couldn't open AccountsDB";
|
||||
|
||||
$user = $a->get($USERNAME) or die "No user $USERNAME in AccountsDB";
|
||||
%props = $user->props;
|
||||
$props{EmailForward} ||= 'local';
|
||||
|
||||
my $fwd = ($props{EmailForward} =~ /^(forward|both)$/) ?
|
||||
sprintf(gettext("Your mail has been forwarded to %s"), ($props{ForwardAddress} || 'devnull@' . $DomainName)) . ".\n" .
|
||||
gettext("This forward is only temporary, you should update your addressbook.") : "";
|
||||
|
||||
my $msg = MIME::Lite->new(
|
||||
Subject => gettext("This account is no longer valid"),
|
||||
From => 'no-reply@' . $DomainName,
|
||||
Data => gettext("This is an automatic message in reply to your email with the following subject:") . "\n\n" .
|
||||
'%S' . "\n\n" .
|
||||
gettext("I'm sorry to inform you that this email address is no longer valid.") . "\n" . $fwd . "\n\n\n\n" .
|
||||
gettext("Please note that this is an automatic email. Do not respond, it won't be treated")
|
||||
);
|
||||
|
||||
$msg->scrub([ 'Date', 'X-Mailer' ]);
|
||||
$msg->attr("content-type" => "text/plain");
|
||||
$msg->attr("content-type.charset" => "utf-8");
|
||||
|
||||
$OUT = $msg->as_string;
|
||||
|
||||
}
|
15
root/etc/e-smith/templates-user/.qmail/20ExpireAutoReply
Normal file
15
root/etc/e-smith/templates-user/.qmail/20ExpireAutoReply
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
|
||||
use User::pwent;
|
||||
|
||||
my $pwd = $props{'PasswordSet'} || 'no';
|
||||
my $locked = $props{'ExpireLockedOn'} || '';
|
||||
my $reply = $props{'ExpireAutoReply'} || 'enabled';
|
||||
|
||||
if ($pwd eq 'yes' || $locked !~ m/^\d{4}\-\d{1,2}\-\d{1,2}$/ || $reply !~ m/^enabled|yes|on|1$/){
|
||||
return ""
|
||||
}
|
||||
|
||||
$OUT .= "| /usr/bin/qmail-autoresponder " . getpwnam($USERNAME)->dir . "/.lock-auto-reply\n";
|
||||
|
||||
}
|
Reference in New Issue
Block a user