--- loncom/interface/lonmsg.pm	2010/05/29 22:39:52	1.226
+++ loncom/interface/lonmsg.pm	2011/02/13 17:44:51	1.231
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines for messaging
 #
-# $Id: lonmsg.pm,v 1.226 2010/05/29 22:39:52 raeburn Exp $
+# $Id: lonmsg.pm,v 1.231 2011/02/13 17:44:51 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;
@@ -548,7 +549,7 @@ to access the full message.',$url);
             } else {
                 my $sendtext;
                 if (!grep/^\Q$addr\E/,@htmlexcerpt) {
-                    $sendtext = &htmlfree;
+                    $sendtext = $htmlfree;
                 } else {
                     $sendtext = $text;
                 }
@@ -577,7 +578,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 +586,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;
@@ -985,7 +986,9 @@ sub secapply {
     my $rec=shift;
     my $defaultflag=shift;
     $rec=~s/\s+//g;
-    $rec=~s/\@/\:/g;
+    unless ($rec =~ /\:/) {
+        $rec=~s/\@/\:/g;
+    }
     my ($adr,$sections_or_groups)=($rec=~/^([^\(]+)\(([^\)]+)\)/);
     if ($sections_or_groups) {
 	foreach my $item (split(/\;/,$sections_or_groups)) {