PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Mail » Mail_Mime » Bug #4455

addHTMLImage requires attribute SRC of tag IMG in lowercase

Details

Submitted2005-05-27 16:53 UTC
Fromvtamara at pasosdejesus dot org
Assignedcipri
StatusClosed
PackageMail_Mime
PHP Version4.3.11
OSOpenBSD/any
Roadmaps(Not assigned)

Comments

[2005-05-27 16:53 UTC] vtamara at pasosdejesus dot org

Description:
------------
In the BODY if I use <IMG SRC="..">, the Image is not
included, however if use <img src=".."> it is included.

This happens after version 1.32 in CVS of Mail_mime/mime.php

http://cvs.php.net/diff.php/pear/Mail_Mime/mime.php?r1=1.31&r2=1.32&ty=h

Note that you use:

$regex = '#src\s*=\s*(["\']?)' . preg_quote($value['name']) .
'cid:' . $value['cid'], '(["\'])?#'

i.e src only in lowercase.

Reproduce code:
---------------
<?php

# Based on help available at:
# http://www.weberforums.com/sutra14467.htm

include('Mail.php');
include('Mail/mime.php');

$mail = new Mail_mime("\n");
$mail->setHTMLBody('<html><body><IMG SRC="graph.jpg"/></body></html>');
$mail->addHTMLImage('graph.jpg', 'image/jpeg');
$send = Mail::factory('mail');
$body = $mail->get();
$hdrs = $mail->headers(array('From' => 'from@example.com',
'Subject' => 'Buggy'));
$send->send('vtamara@pasosdejesus.org', $hdrs, $body);

?>

Expected result:
----------------
I should receive an email with graph.jpg included.

Actual result:
--------------
The image is an attachment, but it is not displayed in a mail client (e.g mozilla).

[2005-05-27 17:04 UTC] vtamara at informatik dot uni-kl dot de

A solution: In mime.php, replace

regex = '#src\s*=\s*(["\']?)' . preg_quote($value['name']) .
'cid:' . $value['cid'], '(["\'])?#';

with

$regex = '#[Ss][Rr][Cc]\s*=\s*(["\']?)' .
preg_quote($value['name']) . '(["\'])?#';

Best regards. God illuminate us.