--- loncom/interface/lonmsg.pm 2022/09/18 22:33:45 1.249 +++ loncom/interface/lonmsg.pm 2024/02/08 01:46:23 1.250 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines for messaging # -# $Id: lonmsg.pm,v 1.249 2022/09/18 22:33:45 raeburn Exp $ +# $Id: lonmsg.pm,v 1.250 2024/02/08 01:46:23 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -454,14 +454,17 @@ sub sendemail { $replytoaddress = 'do-not-reply@'.$hostname; } else { my %senderemails; - my $have_sender; + my ($have_sender.$setreplyto); if ($env{'form.reply_to_addr'}) { my ($replytoname,$replytodom) = split(/:/,$env{'form.reply_to_addr'}); - if (!($replytoname eq $env{'user.name'} && $replytodom eq $env{'user.domain'})) { + if (($replytoname eq $env{'user.name'} && $replytodom eq $env{'user.domain'})) { + $setreplyto = 1; + } else { if (&Apache::lonnet::homeserver($replytoname,$replytodom) ne 'no_host') { %senderemails = &Apache::loncommon::getemails($replytoname,$replytodom); $have_sender = 1; + $setreplyto = 1; } } } @@ -471,7 +474,12 @@ sub sendemail { foreach my $type ('permanentemail','critnotification','notification') { if ($senderemails{$type}) { ($senderaddress) = split(/,/,$senderemails{$type}); - last if ($senderaddress); + if ($senderaddress) { + if ($setreplyto) { + $replytoaddress = $senderaddress; + } + last; + } } } }