version 1.80, 2015/06/18 20:19:06
|
version 1.81, 2015/06/23 02:42:34
|
Line 27
|
Line 27
|
package Apache::lonsupportreq; |
package Apache::lonsupportreq; |
|
|
use strict; |
use strict; |
use MIME::Types; |
|
use MIME::Lite; |
|
use CGI::Cookie(); |
use CGI::Cookie(); |
use Apache::Constants qw(:common); |
use Apache::Constants qw(:common); |
use Apache::loncommon(); |
use Apache::loncommon(); |
Line 880 END
|
Line 878 END
|
} |
} |
} |
} |
|
|
my $msg = MIME::Lite->new( |
my $cc_string; |
From => $from, |
|
To => $to, |
|
Subject => $subject, |
|
Type =>'TEXT', |
|
Data => $supportmsg, |
|
); |
|
if ($homeserver) { |
if ($homeserver) { |
if (@ok_ccs > 0) { |
if (@ok_ccs > 0) { |
my $cc_string = join(', ',@ok_ccs); |
$cc_string = join(', ',@ok_ccs); |
$msg->add("Cc" => $cc_string); |
|
} |
} |
} |
} |
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 = ''; |
my $envdata = ''; |
foreach my $var (@cookievars) { |
foreach my $var (@cookievars) { |
$envdata .= "$var: $cookies{$var}\n"; |
$envdata .= "$var: $cookies{$var}\n"; |
Line 920 END
|
Line 900 END
|
foreach my $var (@loncvars) { |
foreach my $var (@loncvars) { |
$envdata .= "$var: $env{$var}\n"; |
$envdata .= "$var: $env{$var}\n"; |
} |
} |
$msg->attach(Type => 'TEXT', |
$attachment_text = $envdata; |
Data => $envdata); |
|
} |
} |
|
|
### Send it: |
# Compose and send a MIME email |
$msg->send('sendmail'); |
&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+)/[^/]+|) { |
if ($attachmentpath =~ m|$Apache::lonnet::perlvar{'lonDaemons'}/tmp/helprequests/(\d+)/[^/]+|) { |
unlink($attachmentpath); |
unlink($attachmentpath); |