Changeset 4235 in subversion


Ignore:
Timestamp:
Nov 19, 2010 3:45:19 AM (3 years ago)
Author:
alec
Message:
  • Fix handling of custom "_from" in sendmail (#1487132)
  • Small fix in displaying Sender input field
Location:
trunk/roundcubemail
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/steps/mail/compose.inc

    r4223 r4235  
    473473    else if (!empty($_SESSION['compose']['param']['from'])) 
    474474      $from_id = $_SESSION['compose']['param']['from']; 
    475     else if (count($user_identities) > 1) { 
     475    else { 
    476476      $return_path = $MESSAGE->headers->others['return-path']; 
    477477 
     
    502502    $OUTPUT->set_env('signatures', $a_signatures); 
    503503  } 
    504   else 
    505   { 
     504  // no identities, display text input field 
     505  else { 
     506    $field_attrib['class'] = 'from_address'; 
    506507    $input_from = new html_inputfield($field_attrib); 
    507     $out = $input_from->show($_POST['_from']); 
     508    $out = $input_from->show($from_id); 
    508509  } 
    509510 
  • trunk/roundcubemail/program/steps/mail/sendmail.inc

    r4232 r4235  
    213213 
    214214if ($EMAIL_FORMAT_ERROR) { 
    215   $OUTPUT->show_message('emailformaterror', 'error', array('email' => $EMAIL_FORMAT_ERROR));  
     215  $OUTPUT->show_message('emailformaterror', 'error', array('email' => $EMAIL_FORMAT_ERROR)); 
    216216  $OUTPUT->send('iframe'); 
    217217} 
     
    224224  $mailto = 'undisclosed-recipients:;'; 
    225225 
    226 // get sender name and address 
     226// Get sender name and address... 
    227227$from = get_input_value('_from', RCUBE_INPUT_POST, true, $message_charset); 
    228 $identity_arr = rcmail_get_identity($from); 
    229  
    230 if (!$identity_arr && ($from = rcmail_email_input_format($from))) { 
    231   if (preg_match('/(\S+@\S+)/', $from, $m)) 
    232     $identity_arr['mailto'] = $m[1]; 
    233 } else 
    234   $from = $identity_arr['mailto']; 
    235  
    236 if (empty($identity_arr['string'])) 
    237   $identity_arr['string'] = $from; 
     228// ... from identity... 
     229if (is_numeric($from)) { 
     230  if (is_array($identity_arr = rcmail_get_identity($from))) { 
     231    if ($identity_arr['mailto']) 
     232      $from = $identity_arr['mailto']; 
     233    if ($identity_arr['string']) 
     234      $from_string = $identity_arr['string']; 
     235  } 
     236  else { 
     237    $from = null; 
     238  } 
     239} 
     240// ... if there is no identity record, this might be a custom from 
     241else if ($from_string = rcmail_email_input_format($from)) { 
     242  if (preg_match('/(\S+@\S+)/', $from_string, $m)) 
     243    $from = trim($m[1], '<>'); 
     244  else 
     245    $from = null; 
     246} 
     247 
     248if (!$from_string && $from) 
     249  $from_string = $from; 
    238250 
    239251// compose headers array 
     
    282294 
    283295$headers['Date'] = rcmail_user_date(); 
    284 $headers['From'] = rcube_charset_convert($identity_arr['string'], RCMAIL_CHARSET, $message_charset); 
     296$headers['From'] = rcube_charset_convert($from_string, RCMAIL_CHARSET, $message_charset); 
    285297$headers['To'] = $mailto; 
    286298 
     
    332344  $headers['References'] = $_SESSION['compose']['references']; 
    333345 
    334 if (!empty($_POST['_priority'])) 
    335   { 
     346if (!empty($_POST['_priority'])) { 
    336347  $priority = intval($_POST['_priority']); 
    337348  $a_priorities = array(1=>'highest', 2=>'high', 4=>'low', 5=>'lowest'); 
    338349  if ($str_priority = $a_priorities[$priority]) 
    339350    $headers['X-Priority'] = sprintf("%d (%s)", $priority, ucfirst($str_priority)); 
    340   } 
    341  
    342 if (!empty($_POST['_receipt'])) 
    343   { 
    344   $headers['Return-Receipt-To'] = $identity_arr['string']; 
    345   $headers['Disposition-Notification-To'] = $identity_arr['string']; 
    346   } 
     351} 
     352 
     353if (!empty($_POST['_receipt'])) { 
     354  $headers['Return-Receipt-To'] = $from_string; 
     355  $headers['Disposition-Notification-To'] = $from_string; 
     356} 
    347357 
    348358// additional headers 
     
    527537 
    528538// encoding subject header with mb_encode provides better results with asian characters 
    529 if (function_exists('mb_encode_mimeheader')) 
    530 { 
     539if (function_exists('mb_encode_mimeheader')) { 
    531540  mb_internal_encoding($message_charset); 
    532541  $headers['Subject'] = mb_encode_mimeheader($headers['Subject'], 
     
    538547$MAIL_MIME->headers($headers); 
    539548 
    540 // Begin SMTP Delivery Block  
     549// Begin SMTP Delivery Block 
    541550if (!$savedraft) 
    542551{ 
    543   // check for 'From' address (identity may be incomplete) 
    544   if ($identity_arr && !$identity_arr['mailto']) { 
     552  // check 'From' address (identity may be incomplete) 
     553  if (empty($from)) { 
    545554    $OUTPUT->show_message('nofromaddress', 'error'); 
    546     $OUTPUT->send('iframe');  
     555    $OUTPUT->send('iframe'); 
    547556  } 
    548557 
  • trunk/roundcubemail/skins/default/mail.css

    r4184 r4235  
    13301330} 
    13311331 
     1332input.from_address 
     1333{ 
     1334  width: 80% !important; 
     1335} 
     1336 
    13321337#compose-cc, 
    13331338#compose-bcc, 
Note: See TracChangeset for help on using the changeset viewer.