Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 按名称获取跨国家电子邮件id_Php_Email_Magento_Backend_Magento 1.9 - Fatal编程技术网

Php 按名称获取跨国家电子邮件id

Php 按名称获取跨国家电子邮件id,php,email,magento,backend,magento-1.9,Php,Email,Magento,Backend,Magento 1.9,有人知道如何通过在后端设置的名称获取电子邮件的id吗?我有一封在后端事务性电子邮件中创建的电子邮件,我想通过编程发送它,但它的id可能会因我所在的实例(本地、现场、阶段)而异,我只能为它提供相同的名称。 我有这个: Mage::getModel('core/email_template')->sendTransactional( $templateId, $sender, $recepientEmail, $recepientName, $vars, $store); 我需要找

有人知道如何通过在后端设置的名称获取电子邮件的id吗?我有一封在后端事务性电子邮件中创建的电子邮件,我想通过编程发送它,但它的id可能会因我所在的实例(本地、现场、阶段)而异,我只能为它提供相同的名称。 我有这个:

Mage::getModel('core/email_template')->sendTransactional(
$templateId, 
$sender, 
$recepientEmail, 
$recepientName, 
$vars, 
$store);

我需要找到$templateId,我只知道我用“Tests”的名字保存了邮件。

您可以获得电子邮件模板:

$templateName = “Test”;
$emailTemplate = Mage::getModel('core/email_template')->loadByCode($templateName);
获取id:

$templateId = $emailTemplate->getId();
然后在途中发送电子邮件:

Mage::getModel('core/email_template')->sendTransactional(
    $templateId, 
    $sender, 
    $recepientEmail, 
    $recepientName, 
    $vars, 
    $store
);
或使用“我的”方法:


请检查下面的代码。无论如何,这是我关于stackoverflow的第一个答案

$templateName = "Tests";
$templateID = Mage::getModel('core/email_template')->loadByCode($templateName)->getId();
$templateName = "Tests";
$templateID = Mage::getModel('core/email_template')->loadByCode($templateName)->getId();