Reply to inline HTML images using PEAR's mail_mime?

Your name:

Reply:


Posted by lawpoop on 11/29/07 16:33

Hello all --

I'm having a problem getting images to appear in the body of an HTML
email using PEAR's mail_mime class.

Here's my code, what am I doing wrong?

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

$text = "Text version of email";

$html = "<html><body>HTML version of email.<p>This is a <b>test</b> of
html capabilities <font color=\"red\">within</font> the <i>body</i> of
the email.</p><img src=\"logo.jpg\" /></body></html>";

$file = "./images/logo.jpg";

$crlf = "\n";

$hdrs = array(
"From" => "lawpoop@gmail.com",
"Subject" => "Test message"
);

$mime = new Mail_mime($crlf);

$mime -> setTXTBody($text);

$mime -> addHTMLImage("./images/logo.jpg");

$mime -> setHTMLBody($html);

$mime -> addAttachment( $file, "image/jpeg" );

$body = $mime->get();

$hdrs = $mime->headers($hdrs);

$mail =& Mail::factory("mail");

$mail -> send("lawpoop@gmail.com", $hdrs, $body);

echo "<p><b>Message sent!</b></p>";

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация