--- loncom/interface/lonmsg.pm 2010/10/28 16:20:50 1.228 +++ loncom/interface/lonmsg.pm 2014/12/11 01:53:22 1.237 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines for messaging # -# $Id: lonmsg.pm,v 1.228 2010/10/28 16:20:50 bisitz Exp $ +# $Id: lonmsg.pm,v 1.237 2014/12/11 01:53:22 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -465,6 +465,7 @@ sub sendemail { if ($senderaddress) { $msg->add('From',$senderaddress); } + $msg->add('Content-type','text/plain; charset=UTF-8'); if (my $fh = $msg->open()) { print $fh $body; $fh->close; @@ -525,7 +526,10 @@ sub sendnotification { to access the full message.',$url); my %userenv = &Apache::lonnet::get('environment',['notifywithhtml'],$toudom,$touname); - my $subject = &mt_user($user_lh,"'New' $critical message from ").$sender; + my $subject = &mt_user($user_lh,"'New'$critical message from [_1]",$sender); + unless ($subj eq '') { + $subject = $subj; + } my ($blocked,$blocktext); if (!$crit) { @@ -577,7 +581,7 @@ sub make_htmlfree { sub mynewmail{ &newmail(); - return $env{'user.mailcheck.lastnewmassagetime'} > $env{'user.mailcheck.lastvisit'}; + return $env{'user.mailcheck.lastnewmessagetime'} > $env{'user.mailcheck.lastvisit'}; } @@ -585,7 +589,7 @@ sub newmail { if ((time-$env{'user.mailcheck.time'})>300) { my %what=&Apache::lonnet::get('email_status',['recnewemail']); &Apache::lonnet::appenv({'user.mailcheck.time'=>time}); - &Apache::lonnet::appenv({'user.mailcheck.lastnewmassagetime'=> $what{'recnewemail'}}); + &Apache::lonnet::appenv({'user.mailcheck.lastnewmessagetime'=> $what{'recnewemail'}}); if ($what{'recnewemail'}>0) { return 1; } } return 0; @@ -621,7 +625,7 @@ sub retrieve_author_res_msg { my ($domain,$author)=($url=~/^($match_domain)\/($match_username)\//); my %errormsgs=&Apache::lonnet::dump('nohist_res_msgs',$domain,$author); my $msgs=''; - foreach (keys %errormsgs) { + foreach (keys(%errormsgs)) { if ($_=~/^\Q$url\E\_\d+$/) { my %content=&unpackagemsg($errormsgs{$_}); $msgs.='
'.
@@ -897,7 +901,9 @@ sub user_normal_msg {
}
sub process_sent_mail {
- my ($msgsubj,$subj_prefix,$numsent,$stamp,$msgname,$msgdom,$msgcount,$context,$pid,$savemsg,$recusers,$recudoms,$baseurl,$attachmenturl,$symb,$error,$senderuname,$senderdom,$recipid) = @_;
+ my ($msgsubj,$subj_prefix,$numsent,$stamp,$msgname,$msgdom,$msgcount,
+ $context,$pid,$savemsg,$recusers,$recudoms,$baseurl,$attachmenturl,
+ $symb,$error,$senderuname,$senderdom,$recipid) = @_;
my $sentsubj;
if ($numsent > 1) {
$sentsubj = $subj_prefix.' ('.$numsent.' sent) '.$msgsubj;
@@ -985,6 +991,9 @@ sub secapply {
my $rec=shift;
my $defaultflag=shift;
$rec=~s/\s+//g;
+ unless ($rec =~ /\:/) {
+ $rec=~s/\@/\:/g;
+ }
my ($adr,$sections_or_groups)=($rec=~/^([^\(]+)\(([^\)]+)\)/);
if ($sections_or_groups) {
foreach my $item (split(/\;/,$sections_or_groups)) {