[Svn] r4235 - in trunk/roundcubemail: program/steps/mail skins/default

trac at roundcube.net trac at roundcube.net
Fri Nov 19 09:45:19 CET 2010


Author: alec
Date: 2010-11-19 02:45:19 -0600 (Fri, 19 Nov 2010)
New Revision: 4235

Modified:
   trunk/roundcubemail/program/steps/mail/compose.inc
   trunk/roundcubemail/program/steps/mail/sendmail.inc
   trunk/roundcubemail/skins/default/mail.css
Log:
- Fix handling of custom "_from" in sendmail (#1487132)
- Small fix in displaying Sender input field


Modified: trunk/roundcubemail/program/steps/mail/compose.inc
===================================================================
--- trunk/roundcubemail/program/steps/mail/compose.inc	2010-11-18 18:57:33 UTC (rev 4234)
+++ trunk/roundcubemail/program/steps/mail/compose.inc	2010-11-19 08:45:19 UTC (rev 4235)
@@ -472,7 +472,7 @@
       $from_id = get_input_value('_from', RCUBE_INPUT_POST);
     else if (!empty($_SESSION['compose']['param']['from']))
       $from_id = $_SESSION['compose']['param']['from'];
-    else if (count($user_identities) > 1) {
+    else {
       $return_path = $MESSAGE->headers->others['return-path'];
 
       // Set identity
@@ -501,10 +501,11 @@
     // add signatures to client
     $OUTPUT->set_env('signatures', $a_signatures);
   }
-  else
-  {
+  // no identities, display text input field
+  else {
+    $field_attrib['class'] = 'from_address';
     $input_from = new html_inputfield($field_attrib);
-    $out = $input_from->show($_POST['_from']);
+    $out = $input_from->show($from_id);
   }
 
   return $out;

Modified: trunk/roundcubemail/program/steps/mail/sendmail.inc
===================================================================
--- trunk/roundcubemail/program/steps/mail/sendmail.inc	2010-11-18 18:57:33 UTC (rev 4234)
+++ trunk/roundcubemail/program/steps/mail/sendmail.inc	2010-11-19 08:45:19 UTC (rev 4235)
@@ -212,7 +212,7 @@
 $mailbcc = rcmail_email_input_format(get_input_value('_bcc', RCUBE_INPUT_POST, TRUE, $message_charset), true);
 
 if ($EMAIL_FORMAT_ERROR) {
-  $OUTPUT->show_message('emailformaterror', 'error', array('email' => $EMAIL_FORMAT_ERROR)); 
+  $OUTPUT->show_message('emailformaterror', 'error', array('email' => $EMAIL_FORMAT_ERROR));
   $OUTPUT->send('iframe');
 }
 
@@ -223,19 +223,31 @@
 else if (empty($mailto))
   $mailto = 'undisclosed-recipients:;';
 
-// get sender name and address
+// Get sender name and address...
 $from = get_input_value('_from', RCUBE_INPUT_POST, true, $message_charset);
-$identity_arr = rcmail_get_identity($from);
+// ... from identity...
+if (is_numeric($from)) {
+  if (is_array($identity_arr = rcmail_get_identity($from))) {
+    if ($identity_arr['mailto'])
+      $from = $identity_arr['mailto'];
+    if ($identity_arr['string'])
+      $from_string = $identity_arr['string'];
+  }
+  else {
+    $from = null;
+  }
+}
+// ... if there is no identity record, this might be a custom from
+else if ($from_string = rcmail_email_input_format($from)) {
+  if (preg_match('/(\S+@\S+)/', $from_string, $m))
+    $from = trim($m[1], '<>');
+  else
+    $from = null;
+}
 
-if (!$identity_arr && ($from = rcmail_email_input_format($from))) {
-  if (preg_match('/(\S+@\S+)/', $from, $m))
-    $identity_arr['mailto'] = $m[1];
-} else
-  $from = $identity_arr['mailto'];
+if (!$from_string && $from)
+  $from_string = $from;
 
-if (empty($identity_arr['string']))
-  $identity_arr['string'] = $from;
-
 // compose headers array
 $headers = array();
 
@@ -281,7 +293,7 @@
 }
 
 $headers['Date'] = rcmail_user_date();
-$headers['From'] = rcube_charset_convert($identity_arr['string'], RCMAIL_CHARSET, $message_charset);
+$headers['From'] = rcube_charset_convert($from_string, RCMAIL_CHARSET, $message_charset);
 $headers['To'] = $mailto;
 
 // additional recipients
@@ -331,19 +343,17 @@
 if (!empty($_SESSION['compose']['references']))
   $headers['References'] = $_SESSION['compose']['references'];
 
-if (!empty($_POST['_priority']))
-  {
+if (!empty($_POST['_priority'])) {
   $priority = intval($_POST['_priority']);
   $a_priorities = array(1=>'highest', 2=>'high', 4=>'low', 5=>'lowest');
   if ($str_priority = $a_priorities[$priority])
     $headers['X-Priority'] = sprintf("%d (%s)", $priority, ucfirst($str_priority));
-  }
+}
 
-if (!empty($_POST['_receipt']))
-  {
-  $headers['Return-Receipt-To'] = $identity_arr['string'];
-  $headers['Disposition-Notification-To'] = $identity_arr['string'];
-  }
+if (!empty($_POST['_receipt'])) {
+  $headers['Return-Receipt-To'] = $from_string;
+  $headers['Disposition-Notification-To'] = $from_string;
+}
 
 // additional headers
 $headers['Message-ID'] = $message_id;
@@ -526,8 +536,7 @@
 $MAIL_MIME->setParam('text_charset', $message_charset . ($flowed ? ";\r\n format=flowed" : ''));
 
 // encoding subject header with mb_encode provides better results with asian characters
-if (function_exists('mb_encode_mimeheader'))
-{
+if (function_exists('mb_encode_mimeheader')) {
   mb_internal_encoding($message_charset);
   $headers['Subject'] = mb_encode_mimeheader($headers['Subject'],
     $message_charset, 'Q', "\r\n", 8);
@@ -537,13 +546,13 @@
 // pass headers to message object
 $MAIL_MIME->headers($headers);
 
-// Begin SMTP Delivery Block 
+// Begin SMTP Delivery Block
 if (!$savedraft)
 {
-  // check for 'From' address (identity may be incomplete)
-  if ($identity_arr && !$identity_arr['mailto']) {
+  // check 'From' address (identity may be incomplete)
+  if (empty($from)) {
     $OUTPUT->show_message('nofromaddress', 'error');
-    $OUTPUT->send('iframe'); 
+    $OUTPUT->send('iframe');
   }
 
   // Handle Delivery Status Notification request

Modified: trunk/roundcubemail/skins/default/mail.css
===================================================================
--- trunk/roundcubemail/skins/default/mail.css	2010-11-18 18:57:33 UTC (rev 4234)
+++ trunk/roundcubemail/skins/default/mail.css	2010-11-19 08:45:19 UTC (rev 4235)
@@ -1329,6 +1329,11 @@
   height: 32px;
 }
 
+input.from_address
+{
+  width: 80% !important;
+}
+
 #compose-cc,
 #compose-bcc,
 #compose-replyto,

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list