Question

I have created the custom module, in this I have send an email with product information with product image. working fine but Image is not displaying, only url is displaying in mail.

my code is:

observer.php


public function customerRegisterSuccess(Varien_Event_Observer $observer)
    {
        if (Mage::registry('my_observer_has_run')) {
            return $this;
        }

    Mage::register('my_observer_has_run', true);

  ....

                $emailTemplateVariables['Product_Name'] = $information['name'];
                $emailTemplateVariables['Product_Price'] = $information['price'];
                $emailTemplateVariables['Product_SKU'] = $information['sku'];
                $emailTemplateVariables['Product_Description'] = $information['description'];

                if (count($product->getMediaGalleryImages()) > 0){
                    foreach ($product->getMediaGalleryImages() as $_image){
                        $thumbnail12 = Mage::helper('catalog/image')->init($product->getProduct(), 'image', $_image->getFile())->resize(2000);
                        $thumbnail13 = str_replace('/webApps/migration/productapi/new/','/',$thumbnail12);
                        $emailTemplateVariables['Product_Image']=$thumbnail13;
                    }
                    }
.....


    }

in locale\en_US\template\email\custom_mail.html

Thank You.<br /><br/><br/><br/>


<b>Product Details</b><br/><br/>

<a href="{{store url=""}}"><img src="{{var Product_Image}}" alt="{{var Product_Image}}" style="margin-bottom:10px;" border="0"/></a>


Product Name                 : {{var Product_Name}}.<br/>
Product Price                : {{var Product_Price}}.<br/>
Product SKU                  : {{var Product_SKU}}.<br/>
Product Description          : {{var Product_Description}}.<br/></br><br/><br/>

my mail receiving below text.

Thank you,

Product Details

http://localhost/magento/media/catalog/product/cache/1/image/2000x/9df78eab33525d08d6e5fb8d27136e95/c/o/computer.jpg.
Product Name : Monitor.
Product Price : 1000.0000.
Product SKU : Dell001.
Product Description : Monitor.

mail is receiving but image is not displaying in mail.

can you tell me how can I solve this?

thanks.

Was it helpful?

Solution

i think because you are working on local and g mail doesn't know about local-host image path try with some static live image URL and check its working or not

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top