Bug 39907 - "no recipients" plus trace info; [WARN]  at C4/Letters.pm (while it had a to_address)
Summary: "no recipients" plus trace info; [WARN]  at C4/Letters.pm (while it had a to_...
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Notices (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-05-15 12:23 UTC by Marcel de Rooy
Modified: 2025-05-15 12:24 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcel de Rooy 2025-05-15 12:23:53 UTC
Above warnings with trace in plack-opac-error.log
In our 23.11 referred to Letters line 1558 (last line of the last catch block in sub _send_message_by_email)

The caller was opac-sendbasket.pl

Hard to see what happened here. opac-sendbasket will not send a mail without an email address. And Koha::Email::create checks the validity of the to address with Email::Address (no corresponding warn detected).
I also saw this preceding warning:
[2025/05/12 17:13:17] [WARN] Use of uninitialized value in string ne at /usr/share/koha/C4/Letters.pm line 1526.
Which is the line:
    _update_message_to_address( $message->{'message_id'}, $email->email->header('To') )
      if !$message->{to_address}
      || $message->{to_address} ne $email->email->header('To');

So at that point $message->{to_address} was not false! And therefore the To header must have been undefined and written back to the message! If you encounter this, should you already bail out ?

Later on, Letters called send_or_die on the email (with an emptied To header). And this produced the warning "no recipients" from the module Email::Sender::Simple. Interestingly, this modules does not use Email::Address to parse the addresses (again), but uses Email::Address::XS.
This triggers the above warns.

Any idea?