Main Koha release repository
https://koha-community.org
Martin Renvoize
3955815a47
Koha used to rely on Mail::Sendmail for sending emails. As an SMTP client, the library would extract the from address from the Sender header to pass along in the MAIL FROM: field of the SMTP protocol [1]. This was overlooked when we moved to Email::Stuffer/Email::Simple and there's a different behavior as it expects the envelope to be passed and falls back to extracting the 'From' header when said envelope is not found [2]. This patchset re-introduces the behavior from Mail::Sendmail by overriding the send_or_die method locally (in Koha::Email) and doing the right thing. Unless an explicit {from} parameter is passed, it extracts the MAIL FROM envelope from the Sender header, as Mail::Sendmail did, and calls $self->SUPER::send_or_die with the right parameters. To test: 1. Apply the unit tests 2. Run: $ kshell k$ prove t/Koha/Email.t => FAIL: Sender is not handled correctly! 3. Apply this patch 4. Repeat 2 => SUCCESS: Tests pass! The from parameter is correct! No Sender header sent! 5. Sign off :-D [1] https://metacpan.org/dist/Mail-Sendmail/source/lib/Mail/Sendmail.pm#L284 [2] https://metacpan.org/pod/Email::Sender::Manual::QuickStart#envelope-information Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> AMENDED (SHORTENED) - my @headers = $self->email->header_str_pairs; - foreach my $pair ( pairs @headers ) { - my ( $header, $value ) = @$pair; - $args->{from} = $value if $header eq 'Sender'; - } - - # Remove the Sender header - $self->email->header_str_set('Sender'); + $args->{from} = $self->email->header_str('Sender'); + $self->email->header_str_set('Sender'); # remove Sender header Tested with same results (scrambled domains): From: noreply@mydevserver.com Cc: marcel@email.nl To: test@somewhere.nl Reply-To: bieb@mydevserver.com Return-Path: postmaster@mydevserver.com Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> |
||
---|---|---|
acqui | ||
admin | ||
api | ||
authorities | ||
basket | ||
bin | ||
C4 | ||
catalogue | ||
cataloguing | ||
circ | ||
clubs | ||
course_reserves | ||
debian | ||
docs | ||
errors | ||
etc | ||
ill | ||
installer | ||
Koha | ||
koha-tmpl | ||
labels | ||
lib/CGI/Session/Serialize | ||
members | ||
misc | ||
offline_circ | ||
opac | ||
patron_lists | ||
patroncards | ||
plugins | ||
pos | ||
reports | ||
reserve | ||
reviews | ||
rotating_collections | ||
serials | ||
services | ||
skel | ||
suggestion | ||
svc | ||
t | ||
tags | ||
tmp/modified_authorities | ||
tools | ||
virtualshelves | ||
xt | ||
.editorconfig | ||
.eslintrc.json | ||
.gitignore | ||
.htaccess | ||
.mailmap | ||
.perlcriticrc | ||
.proverc.dist | ||
.scss-lint.yml | ||
about.pl | ||
app.psgi | ||
changelanguage.pl | ||
cpanfile | ||
fix-perl-path.PL | ||
gulpfile.js | ||
help.pl | ||
INSTALL | ||
Koha.pm | ||
koha_perl_deps.pl | ||
kohaversion.pl | ||
LICENSE | ||
mainpage.pl | ||
Makefile.PL | ||
MANIFEST.SKIP | ||
package.json | ||
README | ||
README.md | ||
README.robots | ||
rewrite-config.PL | ||
yarn.lock |
Koha is a free software integrated library system (ILS).
Koha is distributed under the GNU GPL version 3 or later.
Note: Koha does not accept pull requests from git hosting sites.
Note: This project has its own bug tracker, to report a bug or submit a patch visit http://bugs.koha-community.org.
For guidelines on submitting patches for Koha please visit https://wiki.koha-community.org/wiki/SubmitingAPatch
The developers handbook can be found at https://wiki.koha-community.org/wiki/Developer_handbook