--- loncom/interface/lonmsg.pm 2006/06/12 22:55:23 1.185 +++ loncom/interface/lonmsg.pm 2006/11/01 22:22:31 1.186 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines for messaging # -# $Id: lonmsg.pm,v 1.185 2006/06/12 22:55:23 albertel Exp $ +# $Id: lonmsg.pm,v 1.186 2006/11/01 22:22:31 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -210,12 +210,21 @@ sub unpackmsgid { sub sendemail { my ($to,$subject,$body)=@_; + my %senderemails=&Apache::loncommon::getemails(); + my $senderaddress=''; + foreach my $type ('notification','permanentemail','critnotification') { + if ($senderemails{$type}) { + $senderaddress=$senderemails{$type}; + } + } $body= "*** ".&mt('This is an automatic message generated by the LON-CAPA system.')."\n". - "*** ".&mt('Please do not reply to this address.')."\n\n".$body; + "*** ".($senderaddress?&mt('You can reply to this message'):&mt('Please do not reply to this address.')."\n*** ". + &mt('A reply will not be received by the recipient!'))."\n\n".$body; my $msg = new Mail::Send; $msg->to($to); $msg->subject('[LON-CAPA] '.$subject); + if ($senderaddress) { $msg->add('Reply-to',$senderaddress); } if (my $fh = $msg->open()) { print $fh $body; $fh->close; @@ -390,9 +399,7 @@ sub user_crit_msg_raw { $status='no_host'; } # Notifications - my %userenv = &Apache::lonnet::get('environment',['critnotification', - 'permanentemail'], - $domain,$user); + my %userenv = &Apache::loncommon::getemails($user,$domain); if ($userenv{'critnotification'}) { &sendnotification($userenv{'critnotification'},$user,$domain,$subject,1, $text);