From 434b6e2aa2f0020a209d1068540162d3e9a9c57c Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Tue, 26 Jan 2016 17:29:11 +0100 Subject: [PATCH] Combine message into 1 template --- .../templates-user/.lock-auto-reply/message.txt/00Setup | 14 -------------- .../.lock-auto-reply/message.txt/10Message | 16 +++++++++++++--- 2 files changed, 13 insertions(+), 17 deletions(-) delete mode 100644 root/etc/e-smith/templates-user/.lock-auto-reply/message.txt/00Setup diff --git a/root/etc/e-smith/templates-user/.lock-auto-reply/message.txt/00Setup b/root/etc/e-smith/templates-user/.lock-auto-reply/message.txt/00Setup deleted file mode 100644 index be77f17..0000000 --- a/root/etc/e-smith/templates-user/.lock-auto-reply/message.txt/00Setup +++ /dev/null @@ -1,14 +0,0 @@ -{ -# vim: ft=perl: -die "USERNAME not set." unless defined ($USERNAME); - -use esmith::AccountsDB; -$adb = esmith::AccountsDB->open_ro or die "Couldn't open AccountsDB"; - -$user = $adb->get($USERNAME) or die "No user $USERNAME in AccountsDB"; - -%props = $user->props; -$props{EmailForward} ||= 'local'; - -$OUT = ''; -} diff --git a/root/etc/e-smith/templates-user/.lock-auto-reply/message.txt/10Message b/root/etc/e-smith/templates-user/.lock-auto-reply/message.txt/10Message index a9d8b43..a645401 100644 --- a/root/etc/e-smith/templates-user/.lock-auto-reply/message.txt/10Message +++ b/root/etc/e-smith/templates-user/.lock-auto-reply/message.txt/10Message @@ -1,5 +1,6 @@ { +use esmith::AccountsDB; use esmith::I18N; use Locale::gettext; use MIME::Lite; @@ -7,19 +8,28 @@ 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 => "\$USER@" . $DomainName, + 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 the email address \$RECIPIENT is no longer valid.") . "\n" . $fwd + gettext("I'm sorry to inform you that the email address \$RECIPIENT 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' ]); +$msg->scrub([ 'Date', 'X-Mailer' ]); $msg->attr("content-type" => "text/plain"); $msg->attr("content-type.charset" => "utf-8");