RE: [PEAR-DEV] Mail_Mime sending HTML-mail example ::: inline image
| From: | Urs Gehrig | Date: | Fri, 31 May 2002 15:06:05 +0000 |
| Subject: | RE: [PEAR-DEV] Mail_Mime sending HTML-mail example ::: inline image | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-6686@lists.php.net to get a copy of this message | ||
dear all
a way to include images inline could is the following:
http://www.ietf.org/rfc/rfc2397.txt, The
"data" URL scheme
simply use XML_image2svg for it, because it saves you some
lines of code and it works for svg. this on the other hand
is untested:
<?php
require_once 'image2svg.php';
$i = &new XML_image2svg("test.gif" );
$img = sprintf("<img src=\"data:image/gif;base64,%s\">" ,
$i->encodeImage());
print("<html>$img</html>");
?>
remind that the data size will be about 30% higher than the image size.
-urs
> -----Original Message-----
> From: Markus Fischer [mailto:mfischer@guru.josefine.at]
> Sent: Friday, May 31, 2002 3:26 PM
> To: Wolfram Kriesing
> Cc: pear-dev@lists.php.net
> Subject: Re: [PEAR-DEV] Mail_Mime sending HTML-mail example
>
>
> Hi,
>
> do you *really* need the images being inline?
>
> I haven't seen a problem yet with sending HTML mails (for
> newsletters, e.g.) which reference the images with an
> absolute URL: <img
> src="http://host/images/spacer.gif" width
> ..
>
> - Markus
>
> On Fri, May 31, 2002 at 01:25:18PM +0200, Wolfram Kriesing wrote :
> > is there a properly working example of how to send a html mail.
> >
> > including pictures which will be attached and sent. and their
> > references within the html file will be converted.
> > does someone have a working example of that?
> > i would be glad to see one. thanks
> >
> > what i am currently doing is:
> >
> > $mime = &new Mail_Mime;
> > $headers['From'] = $data['from'];
> > $headers['Subject'] = $data['subject'];
> > $to = 'wk@dvd-kunden.de';#$data['to'];
> > $mime->setHTMLBody(
> > 'http://some.com.de/index.php' , true );
> > $mime->addHTMLImage('frame.gif');
> > $mime->addHTMLImage('pixel.gif');
> >
> > $mbody = $mime->get();
> > $headers = $mime->headers($headers);
> > $mail = Mail::factory('mail');
> > $mail->send($to, $headers, $mbody);
> >
> > or is there any mistake in there?
> >
> > the html mail i am getting has the iamge names replaced in the html
> > file by those "cid:...." thingys but my mail client (kmail) doesnt
> > show the html-mails properly, the images are always "empty"
> > and the attached files still have to old names.
> >
> > any hints/solutions/examples?
> >
> > --
> > Wolfram
> >
> > ... translating template engine ....
> > http://sf.net/projects/simpletpl
> >
> > ... authentication system ....
> > http://sf.net/projects/auth
> >
> >
> > --
> > PEAR Development Mailing List (http://pear.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc
> Wishlist: http://guru.josefine.at/~mfischer/wishlist
>
> --
> PEAR Development Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>