<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Zend_Mail Obstacles</title>
	<atom:link href="http://www.anty.info/2008/02/18/zend_mail-obstacles/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.anty.info/2008/02/18/zend_mail-obstacles/</link>
	<description>Comments and help on web development.</description>
	<lastBuildDate>Fri, 13 Aug 2010 14:26:24 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: anty</title>
		<link>http://www.anty.info/2008/02/18/zend_mail-obstacles/comment-page-1/#comment-134</link>
		<dc:creator>anty</dc:creator>
		<pubDate>Thu, 22 Apr 2010 11:41:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.anty.info/2008/02/18/zend_mail-obstacles/#comment-134</guid>
		<description>Thanks for the feedback Giannis, I&#039;ll consider a white background next time I change my template!</description>
		<content:encoded><![CDATA[<p>Thanks for the feedback Giannis, I&#8217;ll consider a white background next time I change my template!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Giannis</title>
		<link>http://www.anty.info/2008/02/18/zend_mail-obstacles/comment-page-1/#comment-133</link>
		<dc:creator>Giannis</dc:creator>
		<pubDate>Thu, 22 Apr 2010 07:52:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.anty.info/2008/02/18/zend_mail-obstacles/#comment-133</guid>
		<description>Thank you so much! Didn&#039;t know about the multipart/related type and that this is important for thunderbird to display properly inline images. Nice website but the black background makes it kind of hard to read :)</description>
		<content:encoded><![CDATA[<p>Thank you so much! Didn&#8217;t know about the multipart/related type and that this is important for thunderbird to display properly inline images. Nice website but the black background makes it kind of hard to read <img src='http://www.anty.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Johan de Vries</title>
		<link>http://www.anty.info/2008/02/18/zend_mail-obstacles/comment-page-1/#comment-115</link>
		<dc:creator>Johan de Vries</dc:creator>
		<pubDate>Wed, 23 Sep 2009 14:59:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.anty.info/2008/02/18/zend_mail-obstacles/#comment-115</guid>
		<description>$mail-&gt;setType(Zend_Mime::MULTIPART_RELATED);

^ That was exactly what was missing from my emails. Thanks!</description>
		<content:encoded><![CDATA[<p>$mail-&gt;setType(Zend_Mime::MULTIPART_RELATED);</p>
<p>^ That was exactly what was missing from my emails. Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: anty</title>
		<link>http://www.anty.info/2008/02/18/zend_mail-obstacles/comment-page-1/#comment-96</link>
		<dc:creator>anty</dc:creator>
		<pubDate>Thu, 15 Jan 2009 23:50:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.anty.info/2008/02/18/zend_mail-obstacles/#comment-96</guid>
		<description>Thanks for the suggestion Ben. It&#039;s actually the blogging software &quot;Wordpress&quot; that strips all but a few styling tags. I would search for or write a plugin that replaces strip_tags() with htmlentities(), but that would take away the option to post formatted comments.
Thank you for your comments, Ben!</description>
		<content:encoded><![CDATA[<p>Thanks for the suggestion Ben. It&#8217;s actually the blogging software &#8220;WordPress&#8221; that strips all but a few styling tags. I would search for or write a plugin that replaces strip_tags() with htmlentities(), but that would take away the option to post formatted comments.<br />
Thank you for your comments, Ben!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben W</title>
		<link>http://www.anty.info/2008/02/18/zend_mail-obstacles/comment-page-1/#comment-95</link>
		<dc:creator>Ben W</dc:creator>
		<pubDate>Thu, 15 Jan 2009 12:01:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.anty.info/2008/02/18/zend_mail-obstacles/#comment-95</guid>
		<description>It seems that the HTML tags got removed from my last post.

I would suggest using htmlentities() instead of strip_tags()

:)</description>
		<content:encoded><![CDATA[<p>It seems that the HTML tags got removed from my last post.</p>
<p>I would suggest using htmlentities() instead of strip_tags()</p>
<p> <img src='http://www.anty.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben W</title>
		<link>http://www.anty.info/2008/02/18/zend_mail-obstacles/comment-page-1/#comment-94</link>
		<dc:creator>Ben W</dc:creator>
		<pubDate>Thu, 15 Jan 2009 12:00:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.anty.info/2008/02/18/zend_mail-obstacles/#comment-94</guid>
		<description>I found this helpful but I think it&#039;s slightly simpler in Zend Framework 1.7. This seemed to work for me:

&lt;code class=&quot;prettyprint&quot;&gt;$mail = new Zend_Mail();
$msg = &#039;This image should be inline.&#039;;
$image = file_get_contents(&#039;image.gif&#039;);
$im = $mail-&gt;createAttachment($image, &#039;image/gif&#039;, Zend_Mime::DISPOSITION_INLINE, Zend_Mime::ENCODING_BASE64);
$im-&gt;id = &#039;someid&#039;;
$mail-&gt;setBodyHtml($msg)
       -&gt;send();
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>I found this helpful but I think it&#8217;s slightly simpler in Zend Framework 1.7. This seemed to work for me:</p>
<p><code class="prettyprint">$mail = new Zend_Mail();
$msg = 'This image should be inline.';
$image = file_get_contents('image.gif');
$im = $mail-&gt;createAttachment($image, 'image/gif', Zend_Mime::DISPOSITION_INLINE, Zend_Mime::ENCODING_BASE64);
$im-&gt;id = 'someid';
$mail-&gt;setBodyHtml($msg)
       -&gt;send();
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert G.</title>
		<link>http://www.anty.info/2008/02/18/zend_mail-obstacles/comment-page-1/#comment-61</link>
		<dc:creator>Robert G.</dc:creator>
		<pubDate>Thu, 10 Jul 2008 19:03:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.anty.info/2008/02/18/zend_mail-obstacles/#comment-61</guid>
		<description>Thank you for posting the hint about
$mail-&gt;setType(Zend_Mime::MULTIPART_RELATED);

I tried for hours to send a mail with inline images and this was the only thing I did not do.
After adding this line it worked perfectly, thanks again!</description>
		<content:encoded><![CDATA[<p>Thank you for posting the hint about<br />
$mail-&gt;setType(Zend_Mime::MULTIPART_RELATED);</p>
<p>I tried for hours to send a mail with inline images and this was the only thing I did not do.<br />
After adding this line it worked perfectly, thanks again!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: anty</title>
		<link>http://www.anty.info/2008/02/18/zend_mail-obstacles/comment-page-1/#comment-37</link>
		<dc:creator>anty</dc:creator>
		<pubDate>Wed, 09 Apr 2008 08:43:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.anty.info/2008/02/18/zend_mail-obstacles/#comment-37</guid>
		<description>@Wayne: I try to extract the important things from my script for you.
Here&#039;s how to determine the image type:

&lt;code class=&quot;prettyprint&quot;&gt;// getimagesize returns false, if the URL does not exist
if (file_exists($imagePath) &#124;&#124; getimagesize($imagePath)) {
	$image = file_get_contents($imagePath);
	if (function_exists(&#039;exif_imagetype&#039;) &amp;&amp; function_exists(&#039;image_type_to_mime_type&#039;)) {
		$imageType = image_type_to_mime_type(exif_imagetype($imagePath));
	}
}&lt;/code&gt;

I did this to replace all image-tags in my mail template with references to the attached images (cid):

&lt;code class=&quot;prettyprint&quot;&gt;if (!is_null($image)) {
	$cid = md5($image) .&#039;.&#039;. md5(microtime());
	$images[$cid] = array($image, $imageType);
	if (trim($src[1]) == &#039;&#039; &amp;&amp; trim($src[2]) != &#039;&#039;) {
		$templateMessageTemp = preg_replace(&#039;/(&lt;img\\s[^&gt;]*src=)(?:&quot;&#039; . preg_quote($src[2], &#039;/&#039;) .&#039;&quot;&#124;\\\&#039;&#039;. preg_quote($src[2], &#039;/&#039;) .&#039;\\\&#039;)([^&gt;]*&gt;)/i&#039;, &#039;${1}&quot;cid:&#039;. $cid .&#039;&quot;${2}&#039;, $templateMessage);
	} elseif (trim($src[1]) != &#039;&#039;) {
		$templateMessageTemp = preg_replace(&#039;/(&lt;img\\s[^&gt;]*src=)(?:&quot;&#039; . preg_quote($src[1], &#039;/&#039;) .&#039;&quot;&#124;\\\&#039;&#039;. preg_quote($src[1], &#039;/&#039;) .&#039;\\\&#039;)([^&gt;]*&gt;)/i&#039;, &#039;${1}&quot;cid:&#039;. $cid .&#039;&quot;${2}&#039;, $templateMessage);
	}

	if ($templateMessageTemp == $templateMessage) {
		// nothing was replaced (duplicate images whas used), ignore this image
		unset($images[$cid]);
	}

	$templateMessage = $templateMessageTemp;
}&lt;/code&gt;

Here is how I attached the images with the right cid:

&lt;code class=&quot;prettyprint&quot;&gt;// attach images
foreach ($images as $cid =&gt; $image) {
	$imageData = $image[0];
	$imageType = $image[1];
	if ($imageType === false) {
		$at = $mail-&gt;createAttachment($imageData);
	} else {
		$at = $mail-&gt;createAttachment($imageData, $imageType, Zend_Mime::DISPOSITION_INLINE, Zend_Mime::ENCODING_BASE64);
	}

	$at-&gt;id = $cid;
}&lt;/code&gt;

I hope this helps you!</description>
		<content:encoded><![CDATA[<p>@Wayne: I try to extract the important things from my script for you.<br />
Here&#8217;s how to determine the image type:</p>
<p><code class="prettyprint">// getimagesize returns false, if the URL does not exist
if (file_exists($imagePath) || getimagesize($imagePath)) {
	$image = file_get_contents($imagePath);
	if (function_exists('exif_imagetype') &amp;&amp; function_exists('image_type_to_mime_type')) {
		$imageType = image_type_to_mime_type(exif_imagetype($imagePath));
	}
}</code></p>
<p>I did this to replace all image-tags in my mail template with references to the attached images (cid):</p>
<p><code class="prettyprint">if (!is_null($image)) {
	$cid = md5($image) .'.'. md5(microtime());
	$images[$cid] = array($image, $imageType);
	if (trim($src[1]) == '' &amp;&amp; trim($src[2]) != '') {
		$templateMessageTemp = preg_replace('/(&lt;img\\s[^&gt;]*src=)(?:&quot;' . preg_quote($src[2], '/') .'&quot;|\\\''. preg_quote($src[2], '/') .'\\\')([^&gt;]*&gt;)/i', '${1}&quot;cid:'. $cid .'&quot;${2}', $templateMessage);
	} elseif (trim($src[1]) != '') {
		$templateMessageTemp = preg_replace('/(&lt;img\\s[^&gt;]*src=)(?:&quot;' . preg_quote($src[1], '/') .'&quot;|\\\''. preg_quote($src[1], '/') .'\\\')([^&gt;]*&gt;)/i', '${1}&quot;cid:'. $cid .'&quot;${2}', $templateMessage);
	}

	if ($templateMessageTemp == $templateMessage) {
		// nothing was replaced (duplicate images whas used), ignore this image
		unset($images[$cid]);
	}

	$templateMessage = $templateMessageTemp;
}</code></p>
<p>Here is how I attached the images with the right cid:</p>
<p><code class="prettyprint">// attach images
foreach ($images as $cid =&gt; $image) {
	$imageData = $image[0];
	$imageType = $image[1];
	if ($imageType === false) {
		$at = $mail-&gt;createAttachment($imageData);
	} else {
		$at = $mail-&gt;createAttachment($imageData, $imageType, Zend_Mime::DISPOSITION_INLINE, Zend_Mime::ENCODING_BASE64);
	}

	$at-&gt;id = $cid;
}</code></p>
<p>I hope this helps you!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Wayne</title>
		<link>http://www.anty.info/2008/02/18/zend_mail-obstacles/comment-page-1/#comment-36</link>
		<dc:creator>Wayne</dc:creator>
		<pubDate>Wed, 09 Apr 2008 06:30:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.anty.info/2008/02/18/zend_mail-obstacles/#comment-36</guid>
		<description>Thanks for your post on &#039;Inline images are displayed as attachments&#039; ... we have REALLY battled to find any help on attaching images inline with the zend_mail... do you by any chance have a full example of how you attached the images into the body, without the image showing as a jpeg?
thanks a mill!!</description>
		<content:encoded><![CDATA[<p>Thanks for your post on &#8216;Inline images are displayed as attachments&#8217; &#8230; we have REALLY battled to find any help on attaching images inline with the zend_mail&#8230; do you by any chance have a full example of how you attached the images into the body, without the image showing as a jpeg?<br />
thanks a mill!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: alban</title>
		<link>http://www.anty.info/2008/02/18/zend_mail-obstacles/comment-page-1/#comment-10</link>
		<dc:creator>alban</dc:creator>
		<pubDate>Sun, 24 Feb 2008 09:09:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.anty.info/2008/02/18/zend_mail-obstacles/#comment-10</guid>
		<description>new Zend_Mail(&#039;utf-8&#039;); 
thank !!!</description>
		<content:encoded><![CDATA[<p>new Zend_Mail(&#8216;utf-8&#8242;);<br />
thank !!!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
