summaryrefslogtreecommitdiff
path: root/program/steps/mail/viewsource.inc
diff options
context:
space:
mode:
Diffstat (limited to 'program/steps/mail/viewsource.inc')
-rw-r--r--program/steps/mail/viewsource.inc15
1 files changed, 15 insertions, 0 deletions
diff --git a/program/steps/mail/viewsource.inc b/program/steps/mail/viewsource.inc
index 6971e0c8a..87908303d 100644
--- a/program/steps/mail/viewsource.inc
+++ b/program/steps/mail/viewsource.inc
@@ -26,6 +26,21 @@ if ($uid = get_input_value('_uid', RCUBE_INPUT_GET))
$headers = $IMAP->get_headers($uid);
$charset = $headers->charset ? $headers->charset : $IMAP->default_charset;
header("Content-Type: text/plain; charset={$charset}");
+
+ if (!empty($_GET['_save'])) {
+ $filename = ($headers->subject ? $headers->subject : 'roundcube') . '.eml';
+ $browser = new rcube_browser;
+
+ if ($browser->ie && $browser->ver < 7)
+ $filename = rawurlencode(abbreviate_string($filename, 55));
+ else if ($browser->ie)
+ $filename = rawurlencode($filename);
+ else
+ $filename = addcslashes($filename, '"');
+
+ header("Content-Disposition: attachment; filename=\"$filename\"");
+ }
+
$IMAP->print_raw_body($uid);
}
else