@@ -646,8 +656,8 @@ ENDONE
Sent |
- '.$subject.' |
- '.$message.' |
+ '.&cr_to_br($subject).' |
+ '.&cr_to_br($message).' |
';
foreach my $person (@deliveries) {
my ($username,$email) = split(/:/,$person);
@@ -693,10 +703,10 @@ sub broadcast_email {
}
sub get_user_info {
- my ($user,%email_defaults,$ltext) = @_;
+ my ($user,%email_defaults) = @_;
my ($uname,$udom) = split(/:/,$user);
- my %userinfo = &Apache::lonnet::get('environment',['permanenetemail','notification','critnotification',],$udom,$uname);
my @emailtypes = ('permanentemail','critnotification','notification');
+ my %userinfo = &Apache::lonnet::get('environment',\@emailtypes,$udom,$uname);
my $email = '';
foreach my $type (@emailtypes) {
$email = $userinfo{$type};
@@ -712,7 +722,7 @@ sub get_user_info {
$email = $uname.'@'.$email_defaults{$authtype}{$autharg};
}
} else {
- if (defined($email_defaults{$authtype})) {
+ if ((defined($email_defaults{$authtype})) && ($email_defaults{$authtype} ne '')) {
$email = $uname.'@'.$email_defaults{$authtype};
}
}
@@ -730,7 +740,7 @@ sub form_elements {
%{$authtypes} = (
krb4 => 'Kerberos 4',
krb5 => 'Kerberos 5',
- int => 'Internal (LON-CAPA)',
+ internal => 'Internal (LON-CAPA)',
unix => 'Filesystem (UNIX)',
local => 'Local/Customized',
);
@@ -739,16 +749,15 @@ sub form_elements {
sub store_mail {
my ($subject,$message,$domain,$recipients,$attachmenturl,$ltext) = @_;
- my %status = ();
my %servers = ();
my $msgid=&packagemail($subject,$message,$domain,
$recipients,\%servers,$attachmenturl);
# Store in dc email db files on appropriate servers.
foreach my $server (keys(%servers)) {
-# FIXME This needs to be via a subroutine in lonnet
- $status{$server} = &Apache::lonnet::critical(
- 'dcmailput:'.$domain.':'.&Apache::lonnet::escape($msgid).'='.
- &Apache::lonnet::escape($servers{$server}),$server);
+ unless (&Apache::lonnet::dcmailput($domain,$msgid,\%servers,$server) eq 'ok') {
+ &Apache::lonnet::logthis('Storage of dc mail failed for domain'.$domain.' for server: '.
+ $server.'. Message ID was '.$msgid);
+ }
}
}
@@ -811,8 +820,7 @@ sub unpackagemail {
my $value=$parser->get_text('/'.$entry);
my ($username,$email);
if ($entry eq 'recipient') {
- my $attr = $token->[2];
- $username = $$attr{'username'};
+ $username = $token->[2]{'username'};
$username = &HTML::Entities::decode($username,'<>&"');
$content{recipients}{$username} =
&HTML::Entities::decode($value,'<>&"');
@@ -856,4 +864,11 @@ sub echo_form_input {
return $output;
}
+sub cr_to_br {
+ my $incoming = shift;
+ $incoming =~ s/\n/\ /g;
+ return $incoming;
+}
+
+
1;
| |