我创建了自定义模块,在此中,我发送了一封包含产品图像的产品信息的电子邮件。工作正常,但图像没有显示,只有URL在邮件中显示。

我的代码是:

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;
                    }
                    }
.....


    }

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/>

我的邮件在下面收到文字。

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.

邮件正在接收,但图像没有在邮件中显示。

你能告诉我如何解决这个问题吗?

谢谢。

有帮助吗?

解决方案

我认为,因为您正在使用本地和G邮件不知道本地宿主图像路径尝试使用一些静态现场图像URL尝试并检查其工作是否工作

许可以下: CC-BY-SA归因
scroll top