Bug 8000: (QA follow-up) Update the to_address in the message queue
authorMaryse Simard <maryse.simard@inlibro.com>
Tue, 5 Feb 2019 23:24:23 +0000 (18:24 -0500)
committerNick Clemens <nick@bywatersolutions.com>
Mon, 29 Apr 2019 15:08:47 +0000 (15:08 +0000)
Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
C4/Letters.pm

index c23d8cc..2ce5db3 100644 (file)
@@ -1324,7 +1324,7 @@ sub _send_message_by_email {
 
     $sendmail_params{'Auth'} = {user => $username, pass => $password, method => $method} if $username;
 
-    _update_message_to_address($message->{'message_id'},$to_address) unless $message->{to_address}; #if initial message address was empty, coming here means that a to address was found and queue should be updated
+    _update_message_to_address($message->{'message_id'},$sendmail_params{To}) if $message->{to_address} ne $sendmail_params{To}; #if initial message address was empty, coming here means that a to address was found and queue should be updated; same if to address was overriden by create_message_headers
 
     if ( Mail::Sendmail::sendmail( %sendmail_params ) ) {
         _set_message_status( { message_id => $message->{'message_id'},