【问题标题】:send form data as email in Magento在 Magento 中以电子邮件形式发送表单数据
【发布时间】:2010-08-26 00:17:59
【问题描述】:

如何将表单数据发送到 Magento 中的预设电子邮件地址(例如联系表单的工作方式)?

编辑:我正在尝试在静态块中有一个表单,当提交时,将表单数据发送到电子邮件地址 (admin@mystore.com)

【问题讨论】:

  • 您是否尝试过编写 phtml 模板并通过 mail() 发送电子邮件?
  • @Rito - 不知道是怎么做到的

标签: magento


【解决方案1】:

我不确定你需要什么。这是自定义静态公式的示例。您只需要创建一个 phtml 模板并将其添加到 cms 页面中。

在 RTE 中:

{{block type="core/template" name="myformular" template="contacts/myformular.phtml"}} 

或在 xml 布局中

<reference name="content">
    <block type="core/template" name="myformular" template="contacts/myformular.phtml" />
</reference>

在该 phtml 文件中,您可以使用纯 php 设计您的邮件
How to send email with php

【讨论】:

    【解决方案2】:
    // Send mail:
    $mail = Mage::getModel('core/email')
        ->setToName('Prajapati jignesh')
        ->setToEmail('jignesh@gmail.com')
        ->setBody('Message body')
        ->setSubject('Message subject')
        ->setType('text'); // or html
    try{
        $mail->send();
    }
    catch(Exception $error)
    {
        // Could not send email
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-01-01
      • 2013-10-07
      • 1970-01-01
      • 2023-03-14
      • 1970-01-01
      相关资源
      最近更新 更多