[Bug 29501] New: gather_print_notices.pl does not use SMTP servers
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29501 Bug ID: 29501 Summary: gather_print_notices.pl does not use SMTP servers Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Command-line Utilities Assignee: koha-bugs@lists.koha-community.org Reporter: magnus@libriotech.no QA Contact: testopia@bugs.koha-community.org CC: robin@catalyst.net.nz Bug 22343 added the ability to specify SMTP servers for outgoing email, removing the need to run an MTA (like postfix) on the server. As far as I can tell, gather_print_notices.pl does it's own email sending with MIME::Lite, bypassing the message_queue and the SMTP server setup. So in order to use this as a cronjob to send print as email, you have to run an MTA anyway. Could this be fixed, so the script uses the SMTP server setup? -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29501 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=29330 CC| |jonathan.druart+koha@gmail. | |com Depends on| |22343 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22343 [Bug 22343] Add configuration options for SMTP servers -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29501 --- Comment #1 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 127789 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=127789&action=edit Bug 29501: Make gather_print_notices.pl use Koha::Email This patch makes the cronjob script use Koha::Email and thus relying on configured SMTP settings instead of just trying localhost. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29501 --- Comment #2 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 127790 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=127790&action=edit Bug 29501: Remove MIME::Lite dependency The library usage is discouraged by the current maintainer and we don't use it in the codebase anymore. To test: 1. Apply this patch 2. Run: $ git grep MIME::Lite => SUCCESS: No uses of the removed library 3. Sign off :-D -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29501 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff CC| |martin.renvoize@ptfs-europe | |.com, tomascohen@gmail.com Assignee|koha-bugs@lists.koha-commun |tomascohen@gmail.com |ity.org | --- Comment #3 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Magnus Enger from comment #0)
Bug 22343 added the ability to specify SMTP servers for outgoing email, removing the need to run an MTA (like postfix) on the server.
As far as I can tell, gather_print_notices.pl does it's own email sending with MIME::Lite, bypassing the message_queue and the SMTP server setup. So in order to use this as a cronjob to send print as email, you have to run an MTA anyway.
Could this be fixed, so the script uses the SMTP server setup?
Hi, I'm not familiar with the script enough to write a test plan. Can you test and amend the commit message to include the test plan? Thanks! -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29501 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nick@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29501 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- URL| |https://metacpan.org/pod/MI | |ME::Lite#WAIT! --- Comment #4 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Tomás Cohen Arazi from comment #2)
Created attachment 127790 [details] [review] Bug 29501: Remove MIME::Lite dependency
The library usage is discouraged by the current maintainer and we don't use it in the codebase anymore.
https://metacpan.org/pod/MIME::Lite#WAIT! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29501 --- Comment #5 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 127794 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=127794&action=edit Bug 29501: (follow-up) Remove unused MIME::QuotedPrint dependency -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29501 --- Comment #6 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Ping! Consistency? Complete the development? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29501 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #127789|0 |1 is obsolete| | --- Comment #7 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 131446 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=131446&action=edit Bug 29501: Make gather_print_notices.pl use Koha::Email This patch makes the cronjob script use Koha::Email and thus relying on configured SMTP settings instead of just trying localhost. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29501 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #127790|0 |1 is obsolete| | --- Comment #8 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 131447 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=131447&action=edit Bug 29501: Remove MIME::Lite dependency The library usage is discouraged by the current maintainer and we don't use it in the codebase anymore. To test: 1. Apply this patch 2. Run: $ git grep MIME::Lite => SUCCESS: No uses of the removed library 3. Sign off :-D Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29501 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #127794|0 |1 is obsolete| | --- Comment #9 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 131448 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=131448&action=edit Bug 29501: (follow-up) Remove unused MIME::QuotedPrint dependency Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29501 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off --- Comment #10 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Well.. this all appears to work for me.. so Signing Off. However.. QA note.. shouldn't the 'send_or_die' call be wrapped in a try/catch block like elsewhere? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29501 --- Comment #11 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- - unless $format =~ m[^html$|^csv$|^ods$]; + unless $format =~ m/^html$|^csv$|^ods$/; Why? Unnecessary change. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29501 --- Comment #12 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- It does not work for me, I don't see the email being sent. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29501 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Failed QA --- Comment #13 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- You are missing the transport. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29501 --- Comment #14 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- You also need to determinate which SMTP server to use (from which library?). -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29501 --- Comment #15 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Jonathan Druart from comment #11)
- unless $format =~ m[^html$|^csv$|^ods$]; + unless $format =~ m/^html$|^csv$|^ods$/;
Why? Unnecessary change.
I think I did it tepmorarily and then forgot, because of this: https://snipboard.io/3GwSsV.jpg -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29501 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29501 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #131448|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29501 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #131446|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29501 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #131447|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29501 --- Comment #16 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 131989 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=131989&action=edit Bug 29501: Make gather_print_notices.pl use Koha::Email This patch makes the cronjob script use Koha::Email and thus relying on configured SMTP settings instead of just trying localhost. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29501 --- Comment #17 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 131990 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=131990&action=edit Bug 29501: Remove MIME::Lite dependency The library usage is discouraged by the current maintainer and we don't use it in the codebase anymore. To test: 1. Apply this patch 2. Run: $ git grep MIME::Lite => SUCCESS: No uses of the removed library 3. Sign off :-D Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29501 --- Comment #18 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 131991 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=131991&action=edit Bug 29501: (follow-up) Remove unused MIME::QuotedPrint dependency Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29501 --- Comment #19 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 131992 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=131992&action=edit Bug 29501: Use the default transport This patch makes the script pass the default SMTP transport to the ->send_or_die call. The default is picked as this is the current behavior. New enhancements could add the *library_id* to the message_queue table, and allow using different transports depending on that. But it is out of the scope of this bug. To test: 1. Verify messages are being sent. 2. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29501 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |jonathan.druart+koha@gmail. |y.org |com CC| |andrew@bywatersolutions.com --- Comment #20 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Jonathan Druart from comment #14)
You also need to determinate which SMTP server to use (from which library?).
Hi, I've tried to learn more about the feature to answer you, Jonathan. So correct me if I'm wrong. The feature is not that evolved. It is designed to generate the notice(s) in a directory (shared mount?). Print notices are generated in several ways which should be better documented. CHECKOUT is not one of them :-D Thanks to Andrew I now know that you can generate a print notice when trapping a hold for a patron with no valid email. Once you have that (it shows as 'print' on the patron's notices tab), I ran: $ perl misc/cronjobs/gather_print_notices.pl /tmp --email tomascohen@theke.io,andrew@bywatersolutions.com --send --html As you will notice, the --send addresses list is not tied to any Koha feature. You just pass the addresses... I can forsee a development in which we could add print notices addesses configuration to libraries and a --library parameter to the print notices, but it will still require added a library_id column to the message_queue table. Anyway... The follow-up makes it work. It uses the default configured SMTP server. My config: <smtp_server> <host>smtp.gmail.com</host> <port>587</port> <timeout>50</timeout> <ssl_mode>starttls</ssl_mode> <user_name>tomascohen@gmail.com</user_name> <password>xxx</password> <debug>1</debug> </smtp_server> The password I used was generated on the 'generate applilcation password' on my Google account. debug=1 made the SMTP session super verbose. And email arrived at destination :-D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29501 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29501 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #131989|0 |1 is obsolete| | Attachment #131990|0 |1 is obsolete| | Attachment #131991|0 |1 is obsolete| | Attachment #131992|0 |1 is obsolete| | --- Comment #21 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 132003 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132003&action=edit Bug 29501: Make gather_print_notices.pl use Koha::Email This patch makes the cronjob script use Koha::Email and thus relying on configured SMTP settings instead of just trying localhost. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29501 --- Comment #22 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 132004 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132004&action=edit Bug 29501: Remove MIME::Lite dependency The library usage is discouraged by the current maintainer and we don't use it in the codebase anymore. To test: 1. Apply this patch 2. Run: $ git grep MIME::Lite => SUCCESS: No uses of the removed library 3. Sign off :-D Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29501 --- Comment #23 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 132005 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132005&action=edit Bug 29501: (follow-up) Remove unused MIME::QuotedPrint dependency Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29501 --- Comment #24 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 132006 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132006&action=edit Bug 29501: Use the default transport This patch makes the script pass the default SMTP transport to the ->send_or_die call. The default is picked as this is the current behavior. New enhancements could add the *library_id* to the message_queue table, and allow using different transports depending on that. But it is out of the scope of this bug. To test: 1. Verify messages are being sent. 2. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> JD amended patch: revert - unless $format =~ m[^html$|^csv$|^ods$]; + unless $format =~ m/^html$|^csv$|^ods$/; Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29501 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |22.05.00 released in| | CC| |fridolin.somers@biblibre.co | |m Status|Passed QA |Pushed to master --- Comment #25 from Fridolin Somers <fridolin.somers@biblibre.com> --- Pushed to master for 22.05, thanks to everybody involved 🦄 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29501 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kyle@bywatersolutions.com Version(s)|22.05.00 |22.05.00,21.11.05 released in| | Status|Pushed to master |Pushed to stable --- Comment #26 from Kyle M Hall <kyle@bywatersolutions.com> --- Pushed to 21.11.x for 21.11.05 -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org