From:             jason dot anderson at abcphones dot com
Operating system: Windows XP
PHP version:      5.3.0
PHP Bug Type:     Unknown/Other Function
Bug description:  A tab inside ob_start using Eclipse IDE causes a glitch when 
sending HTML email

Description:
------------
Using a text editor (Eclipse) for PHP the attached code will not work
properly when a tab is typed inside of the ob_start() section.  No errors
are reported but when the HTML email is received it is represented as raw
text including the header data.  Debugging for this in such case can be
very very difficult.

Reproduce code:
---------------
function test_html_email(){
$to = '[email protected]';
$subject = 'My Code';
$random_hash = md5(date('r', time()));
$headers = "From: [email protected]\r\nreply-to: [email protected]";
$headers .= "\r\nContent-Type: multipart/alternative;
boundary=\"PHP-alt-".$random_hash."\"";
ob_start(); //Turn on output buffering  - Notice tabs below
?>      --PHP-alt-<?php echo $random_hash; ?> 
        Content-Type: text/plain; charset="iso-8859-1"
        Content-Transfer-Encoding: 7bit
        
        Hello World!!! 
        This is simple text email message.
        
        --PHP-alt-<?php echo $random_hash; ?> 
        Content-Type: text/html; charset="iso-8859-1"
        Content-Transfer-Encoding: 7bit
        
        <h2>Hello World!</h2>
        <p>This is something with <b>HTML</b> formatting.</p>
        
        --PHP-alt-<?php echo $random_hash; ?>--
<?php $message = ob_get_clean();
ob_end_flush();
$mail_sent = @mail( $to, $subject, $message, $headers );
echo $mail_sent ? "Mail sent" : "Mail failed";
}
test_html_email();

Expected result:
----------------
Hello World!
This is something with HTML formatting.


Actual result:
--------------
--PHP-alt-527d2deecd08a0f3e80bced5cace8aaa 
        Content-Type: text/plain; charset="iso-8859-1"
        Content-Transfer-Encoding: 7bit
        
        Hello World!!! 
        This is simple text email message.
        
        --PHP-alt-527d2deecd08a0f3e80bced5cace8aaa 
        Content-Type: text/html; charset="iso-8859-1"
        Content-Transfer-Encoding: 7bit
        
        <h2>Hello World!</h2>
        <p>This is something with <b>HTML</b> formatting.</p>
        
        --PHP-alt-527d2deecd08a0f3e80bced5cace8aaa--


-- 
Edit bug report at http://bugs.php.net/?id=48841&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=48841&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=48841&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=48841&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=48841&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=48841&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=48841&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=48841&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=48841&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=48841&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=48841&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=48841&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=48841&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=48841&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=48841&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=48841&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=48841&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=48841&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=48841&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=48841&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=48841&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=48841&r=mysqlcfg

Reply via email to