From 7e263ea2048721482c00db65d4511f00c4c7b1d4 Mon Sep 17 00:00:00 2001 From: alecpl Date: Wed, 7 Dec 2011 09:35:29 +0000 Subject: - Add option to set default font for HTML message (#1484137) --- program/steps/mail/compose.inc | 6 ++++++ program/steps/mail/sendmail.inc | 19 +++++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) (limited to 'program/steps/mail') diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index 71729602a..03619f1a2 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -142,6 +142,12 @@ $OUTPUT->set_env('recipients_separator', trim($RCMAIL->config->get('recipients_s // use jquery UI for showing prompt() dialogs $RCMAIL->plugins->load_plugin('jqueryui'); +// default font for HTML editor +$font = rcube_fontdefs($RCMAIL->config->get('default_font', 'Verdana')); +if ($font && !is_array($font)) { + $OUTPUT->set_env('default_font', $font); +} + // get reference message and set compose mode if ($msg_uid = $COMPOSE['param']['draft_uid']) { $RCMAIL->imap->set_mailbox($CONFIG['drafts_mbox']); diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc index 0da1ee342..6e124f98f 100644 --- a/program/steps/mail/sendmail.inc +++ b/program/steps/mail/sendmail.inc @@ -397,6 +397,15 @@ $isHtml = (bool) get_input_value('_is_html', RCUBE_INPUT_POST); // fetch message body $message_body = get_input_value('_message', RCUBE_INPUT_POST, TRUE, $message_charset); +if ($isHtml) { + $font = rcube_fontdefs($RCMAIL->config->get('default_font', 'Verdana')); + $bstyle = $font && is_string($font) ? " style='font-family: $font'" : ''; + + // append doctype and html/body wrappers + $message_body = '' . + "\r\n\r\n" . $message_body; +} + if (!$savedraft) { if ($isHtml) { // remove signature's div ID @@ -406,10 +415,6 @@ if (!$savedraft) { $bstyle = 'padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px; width:100%'; $message_body = preg_replace('/
/', '
', $message_body); - - // append doctype and html/body wrappers - $message_body = '' . - "\r\n\r\n" . $message_body; } // Check spelling before send @@ -443,8 +448,10 @@ if (!$savedraft) { if ($footer) $message_body .= "\r\n" . $footer; - if ($isHtml) - $message_body .= "\r\n\r\n"; +} + +if ($isHtml) { + $message_body .= "\r\n\r\n"; } // set line length for body wrapping -- cgit v1.2.3