Bug 10621: use correct from-address for subscription alert emails

From-address and to-address were the same (patron's email) for
subscription alerts. This patch changes 'from' the branch or
kohaadminemailaddress

To test
- add a subscription in staff/serials in case you don't have any
- enable patron notifications or the subscription
- in the OPAC, subscribe to the serial
- in staff/serial, receive an issue of the serial

Before applying the patch, the email that is supposed to be sent
has the patron's email as 'from' and 'to' (and is likely to fail).

If you follow the steps after applying the patch, the email alert
should have the 'from' address of the patron's branch or
kohaadminemiladdress -- which should also work fine with the MTA/SMTP
you have set up for messaging.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 61fa246ac0)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
(cherry picked from commit 75b31bb5cf)
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
(cherry picked from commit 75b31bb5cf)
Signed-off-by: Chris Hall <followingthepath@gmail.com>
(cherry picked from commit eaefa5daf6)
This commit is contained in:
Mirko Tietgen 2013-07-23 23:24:11 +02:00 committed by Chris Hall
parent 06f5c1219a
commit 1c19a49dd4
1 changed files with 2 additions and 1 deletions

View File

@ -281,6 +281,7 @@ sub SendAlerts {
# warn "sending issues...";
my $userenv = C4::Context->userenv;
my $branchdetails = GetBranchDetail($_->{'branchcode'});
my $letter = GetPreparedLetter (
module => 'serial',
letter_code => $letter_code,
@ -297,7 +298,7 @@ sub SendAlerts {
# ... then send mail
my %mail = (
To => $email,
From => $email,
From => $branchdetails->{'branchemail'} || C4::Context->preference("KohaAdminEmailAddress"),
Subject => Encode::encode( "utf8", "" . $letter->{title} ),
Message => Encode::encode( "utf8", "" . $letter->{content} ),
'Content-Type' => 'text/plain; charset="utf8"',