Bug 22343: Make C4::Letters use the new SMTP server config
authorTomas Cohen Arazi <tomascohen@theke.io>
Thu, 6 Aug 2020 15:43:17 +0000 (12:43 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 2 Oct 2020 08:54:40 +0000 (10:54 +0200)
commit3a80954aa3538785af4064f5aa0961c28a9b0685
tree3851bdd28a51e1c2e13f7a2178f7458d5afdc72b
parent178592887bf9fe24d681a6c1d5f64ab1b8b5766e
Bug 22343: Make C4::Letters use the new SMTP server config

This patch makes the different methods in C4::Letters use:
- Koha::SMTP::Servers: to get the effective SMTP server for the library
  or the fallback default if no library in context.
- New Koha::Email->create method for crafting the email envelope for
  sending.

The tests are adapted so they behave the same way, but the trapped (in
the mock) $email object has the right type and its attributes are
accessed correctly.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Letters.t
=> SUCCESS: Tests pass. YAY!
3. Sign off :-D

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
C4/Letters.pm
t/db_dependent/Letters.t