Ignore:
Timestamp:
Feb 25, 2010 3:29:47 PM (3 years ago)
Author:
alec
Message:
  • improve transfer encoding choosing
File:
1 edited

Legend:

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

    r3291 r3292  
    416416} 
    417417 
    418 // chose transfer encoding 
    419 $charset_7bit = array('ASCII', 'ISO-2022-JP', 'ISO-8859-1', 'ISO-8859-2', 'ISO-8859-15'); 
    420 $transfer_encoding = in_array(strtoupper($message_charset), $charset_7bit) ? '7bit' : '8bit'; 
    421  
    422418// add stored attachments, if any 
    423419if (is_array($_SESSION['compose']['attachments'])) 
     
    447443        $attachment['name'], 
    448444        ($attachment['data'] ? false : true), 
    449         ($ctype == 'message/rfc822' ? $transfer_encoding : 'base64'), 
     445        // @TODO: quoted-printable for message/rfc822 is safe, 
     446        // but we should check that 7bit or 8bit is possible here 
     447        ($ctype == 'message/rfc822' ? 'quoted-printable' : 'base64'), 
    450448        ($ctype == 'message/rfc822' ? 'inline' : 'attachment'), 
    451449        $message_charset, '', '',  
     
    456454  } 
    457455} 
     456 
     457// choose transfer encoding for plain/text body 
     458if (preg_match('/[^\x00-\x7F]/', $MAIL_MIME->getTXTBody())) 
     459  $transfer_encoding = '8bit'; 
     460else 
     461  $transfer_encoding = '7bit'; 
    458462 
    459463// encoding settings for mail composing 
Note: See TracChangeset for help on using the changeset viewer.