--- loncom/interface/lonsupportreq.pm 2015/06/18 20:19:06 1.80 +++ loncom/interface/lonsupportreq.pm 2015/06/23 02:42:34 1.81 @@ -1,5 +1,5 @@ # -# $Id: lonsupportreq.pm,v 1.80 2015/06/18 20:19:06 musolffc Exp $ +# $Id: lonsupportreq.pm,v 1.81 2015/06/23 02:42:34 musolffc Exp $ # # Copyright Michigan State University Board of Trustees # @@ -27,8 +27,6 @@ package Apache::lonsupportreq; use strict; -use MIME::Types; -use MIME::Lite; use CGI::Cookie(); use Apache::Constants qw(:common); use Apache::loncommon(); @@ -880,33 +878,15 @@ END } } - my $msg = MIME::Lite->new( - From => $from, - To => $to, - Subject => $subject, - Type =>'TEXT', - Data => $supportmsg, - ); + my $cc_string; if ($homeserver) { if (@ok_ccs > 0) { - my $cc_string = join(', ',@ok_ccs); - $msg->add("Cc" => $cc_string); + $cc_string = join(', ',@ok_ccs); } } - if ($bcc ne '') { - $msg->add("Bcc" => $bcc); - } - $msg->attr("content-type" => "text/plain"); - $msg->attr("content-type.charset" => "UTF-8"); - - if ($homeserver && $attachmentpath) { - my ($type, $encoding) = MIME::Types::by_suffix($attachmentpath); - $msg->attach(Type => $type, - Path => $attachmentpath, - Filename => $fname - ); - } else { + my $attachment_text; + unless ($homeserver && $attachmentpath) { my $envdata = ''; foreach my $var (@cookievars) { $envdata .= "$var: $cookies{$var}\n"; @@ -920,12 +900,12 @@ END foreach my $var (@loncvars) { $envdata .= "$var: $env{$var}\n"; } - $msg->attach(Type => 'TEXT', - Data => $envdata); + $attachment_text = $envdata; } - -### Send it: - $msg->send('sendmail'); + + # Compose and send a MIME email + &Apache::loncommon::mime_email($from, $to, $subject, $supportmsg, $cc_string, $bcc, + $attachmentpath, $fname, $attachment_text); if ($attachmentpath =~ m|$Apache::lonnet::perlvar{'lonDaemons'}/tmp/helprequests/(\d+)/[^/]+|) { unlink($attachmentpath);