RE: [PEAR-DEV] Mail_mime with text/html and images
| From: | Richard Heyes | Date: | Tue, 23 Apr 2002 17:44:50 +0000 |
| Subject: | RE: [PEAR-DEV] Mail_mime with text/html and images | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-5744@lists.php.net to get a copy of this message | ||
> Hi,
> I've got a question with Mail_mime class :
>
> When sending multiparts mails with text, html and images, under
> Sylpheed the mail received looks like this :
>
> ----> text/plain
> ----> multipart/related
> -----------> text/html
> -----------> each images
Using this code:
include('Mail/mime.php');
include('Mail.php');
$m = Mail::factory('mail');
$a = &new Mail_mime();
$a->settxtbody('Yabba');
$a->sethtmlbody('<html><body
background="tbg.gif"><b>Yabba</b></body></html>');
$a->addhtmlimage('/devel/v-webmail.co.uk/htdocs/images/tbg.gif',
'image/gif', 'tbg.gif');
$body = $a->get();
$head = $a->headers();
$m->send('richard', $head, $body);
Mail_mime produces this:
Return-Path: <www@heyes_01.phpguru.org>
Delivered-To: richard@heyes_01.phpguru.org
Received: by heyes_01.phpguru.org (Postfix, from userid 502)
id 0603896565; Tue, 23 Apr 2002 17:36:30 +0000 (GMT)
To: richard@heyes_01.phpguru.org
Subject:
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="=_24f7376744d9cc996f064be979d22100"
Message-Id: <20020423173630.0603896565@heyes_01.phpguru.org>
Date: Tue, 23 Apr 2002 17:36:30 +0000 (GMT)
From: www@heyes_01.phpguru.org (Web Server)
--=_24f7376744d9cc996f064be979d22100
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Yabba
--=_24f7376744d9cc996f064be979d22100
Content-Type: multipart/related;
boundary="=_a90f0163a081c46b65c5ed2c06f29969"
--=_a90f0163a081c46b65c5ed2c06f29969
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<html><body
background=3D"cid:a89c370395a63e98270d9ad30818c3d7"><b>Yabba</b=
></body></html>
--=_a90f0163a081c46b65c5ed2c06f29969
Content-Type: image/gif
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="tbg.gif"
Content-ID: <a89c370395a63e98270d9ad30818c3d7>
<snip>
--=_a90f0163a081c46b65c5ed2c06f29969--
--=_24f7376744d9cc996f064be979d22100--
As you can see it is your desired structure.
--
Richard Heyes
"If you have any trouble sounding condescending,
find a Unix user to show you how it's done." - Scott Adams