Bug 37598 - Ability to use the BCC field for sending notices to multiple addresses, rather than the To field
Summary: Ability to use the BCC field for sending notices to multiple addresses, rathe...
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Notices (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Aleisha Amohia
QA Contact: Testopia
URL:
Keywords:
Depends on: 37623 12802
Blocks:
  Show dependency treegraph
 
Reported: 2024-08-07 22:01 UTC by Aleisha Amohia
Modified: 2025-04-03 01:54 UTC (History)
2 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 37598: Add EmailRecipientField syspref (3.98 KB, patch)
2024-08-13 00:50 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 37598: Use EmailRecipientField for 'to', 'cc' or 'bcc' when sending notices to selected addresses (1.97 KB, patch)
2024-08-13 00:50 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 37598: Add EmailRecipientField syspref (3.98 KB, patch)
2024-08-13 05:13 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 37598: Use EmailRecipientField for 'to', 'cc' or 'bcc' when sending notices to selected addresses (2.00 KB, patch)
2024-08-13 05:13 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 37598: Tests for t/db_dependent/Letters.t (4.54 KB, patch)
2024-08-13 05:13 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 37598: Add EmailRecipientField syspref (3.98 KB, patch)
2024-09-06 00:57 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 37598: Use EmailRecipientField for 'to', 'cc' or 'bcc' when sending notices to selected addresses (2.55 KB, patch)
2024-09-06 00:57 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 37598: Tests for t/db_dependent/Letters.t (6.07 KB, patch)
2024-09-06 00:57 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 37598: Add EmailRecipientField syspref (4.01 KB, patch)
2025-04-02 21:02 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 37598: Use EmailRecipientField for 'to', 'cc' or 'bcc' when sending notices to selected addresses (2.55 KB, patch)
2025-04-02 21:03 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 37598: Tests for t/db_dependent/Letters.t (6.27 KB, patch)
2025-04-02 21:03 UTC, Aleisha Amohia
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Aleisha Amohia 2024-08-07 22:01:15 UTC
Bug 12802 allows libraries to select a list of email address fields to use when sending notices to patrons. You would check all of the email addresses you want to use in a new system preference EmailFieldSelection and Koha will send the notice to all of those addresses.

However, all of those addresses do go through in the To field. They are not in the BCC field.

It would be good to enable the option to use the BCC field for the email addresses rather than the To field.
Comment 1 Aleisha Amohia 2024-08-13 00:50:50 UTC
Created attachment 170249 [details] [review]
Bug 37598: Add EmailRecipientField syspref
Comment 2 Aleisha Amohia 2024-08-13 00:50:52 UTC
Created attachment 170250 [details] [review]
Bug 37598: Use EmailRecipientField for 'to', 'cc' or 'bcc' when sending notices to selected addresses
Comment 3 Aleisha Amohia 2024-08-13 05:13:50 UTC
Created attachment 170254 [details] [review]
Bug 37598: Add EmailRecipientField syspref
Comment 4 Aleisha Amohia 2024-08-13 05:13:52 UTC
Created attachment 170255 [details] [review]
Bug 37598: Use EmailRecipientField for 'to', 'cc' or 'bcc' when sending notices to selected addresses
Comment 5 Aleisha Amohia 2024-08-13 05:13:54 UTC
Created attachment 170256 [details] [review]
Bug 37598: Tests for t/db_dependent/Letters.t

WIP
Comment 6 Aleisha Amohia 2024-09-06 00:57:32 UTC
Created attachment 171112 [details] [review]
Bug 37598: Add EmailRecipientField syspref
Comment 7 Aleisha Amohia 2024-09-06 00:57:35 UTC
Created attachment 171113 [details] [review]
Bug 37598: Use EmailRecipientField for 'to', 'cc' or 'bcc' when sending notices to selected addresses
Comment 8 Aleisha Amohia 2024-09-06 00:57:37 UTC
Created attachment 171114 [details] [review]
Bug 37598: Tests for t/db_dependent/Letters.t

To test:

1. Apply patches and update database, restart services
2. Go to Koha administration -> system preferences, search for EmailFieldPrimary
3. Change EmailFieldPrimary to 'selected addresses'
4. Make a selection in the EmailFieldSelection system preference
5. Notice the new EmailRecipientField system preference, it should be set to "To" by default.

6. Have a patron with different addresses in the email fields, depending on the selection you made in EmailFieldSelection:
- primary email
- alternate email
- secondary email

7. Test the new EmailRecipientField system preference using the Welcome email, found by going to the Patron, clicking More, then choosing "Send Welcome notice"

8. In the command line, go to the database `sudo koha-mysql <instancename>` and look at the message_queue to see who the emails are sent to `select * from message_queue\G`. The to_address will contain all the selected email addresses.

9. In the command line, run `misc/cronjobs/process_message_queue.pl`

10. Confirm that the to_address and cc_address are set appropriately based on EmailRecipientField

12. Repeat steps 7-9, testing with different values of EmailRecipientField. When testing EmailRecipientField with bcc, confirm that the to_address is just the first valid email address. Unfortunately we can't test bcc without actually sending the email.

13. Confirm tests pass t/db_dependent/Letters.t

Sponsored-by: Pymble Ladies' College
Comment 9 Emmanuel Bétemps 2025-04-02 08:09:51 UTC
Hi,

Applying: Bug 37598: Add EmailRecipientField syspref
Using index info to reconstruct a base tree...
M	installer/data/mysql/mandatory/sysprefs.sql
M	koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref
Falling back to patching base and 3-way merge...
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref
CONFLICT (content): Merge conflict in koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref
Auto-merging installer/data/mysql/mandatory/sysprefs.sql
error: Failed to merge in the changes.
Patch failed at 0001 Bug 37598: Add EmailRecipientField syspref
Comment 10 Aleisha Amohia 2025-04-02 21:02:57 UTC
Created attachment 180425 [details] [review]
Bug 37598: Add EmailRecipientField syspref
Comment 11 Aleisha Amohia 2025-04-02 21:03:00 UTC
Created attachment 180426 [details] [review]
Bug 37598: Use EmailRecipientField for 'to', 'cc' or 'bcc' when sending notices to selected addresses
Comment 12 Aleisha Amohia 2025-04-02 21:03:03 UTC
Created attachment 180427 [details] [review]
Bug 37598: Tests for t/db_dependent/Letters.t

To test:

1. Apply patches and update database, restart services
2. Go to Koha administration -> system preferences, search for EmailFieldPrimary
3. Change EmailFieldPrimary to 'selected addresses'
4. Make a selection in the EmailFieldSelection system preference
5. Notice the new EmailRecipientField system preference, it should be set to "To" by default.

6. Have a patron with different addresses in the email fields, depending on the selection you made in EmailFieldSelection:
- primary email
- alternate email
- secondary email

7. Test the new EmailRecipientField system preference using the Welcome email, found by going to the Patron, clicking More, then choosing "Send Welcome notice"

8. In the command line, go to the database `sudo koha-mysql <instancename>` and look at the message_queue to see who the emails are sent to `select * from message_queue\G`. The to_address will contain all the selected email addresses.

9. In the command line, run `misc/cronjobs/process_message_queue.pl`

10. Confirm that the to_address and cc_address are set appropriately based on EmailRecipientField

12. Repeat steps 7-9, testing with different values of EmailRecipientField. When testing EmailRecipientField with bcc, confirm that the to_address is just the first valid email address. Unfortunately we can't test bcc without actually sending the email.

13. Confirm tests pass t/db_dependent/Letters.t

Sponsored-by: Pymble Ladies' College
Comment 13 David Cook 2025-04-02 23:18:49 UTC
Comment on attachment 180426 [details] [review]
Bug 37598: Use EmailRecipientField for 'to', 'cc' or 'bcc' when sending notices to selected addresses

Review of attachment 180426 [details] [review]:
-----------------------------------------------------------------

::: C4/Letters.pm
@@ +1516,5 @@
>          );
>          return;
>      }
> +
> +    my $bcc_address = C4::Context->preference('NoticeBcc');

Wouldn't it make sense to put the following into its own function and then unit test that?
Comment 14 David Cook 2025-04-02 23:19:26 UTC
This is an interesting one. We don't use multi email addresses with Koha at this point, but I have been thinking how it would be nice to be able to use BCC instead of To at times...
Comment 15 Aleisha Amohia 2025-04-03 01:54:51 UTC
(In reply to David Cook from comment #13)
> Wouldn't it make sense to put the following into its own function and then
> unit test that?

The function it's in is already a hidden one, so I'm not sure that would add much more value or clarity at the moment? But happy to be told I'm wrong, just trying to use our sponsorship wisely here :)