2016-04-11 4 views
0

Hallo Leute, ich versuche, eine E-Mail in Magento mit benutzerdefinierten E-Mail-Vorlagen zu senden. Aber ich bekomme eine Ausnahme Ich habe SMTP Pro Extension installiert.Nicht möglich, E-Mail mit benutzerdefinierten Vorlage in Magento 1.9.2 Community Edition senden

Ich Listing Code hier: -

Mein config.xml

<template> 
    <email> 
    <custom_abc_email_template module="custom_abc"> 
     <label>Custom Template</label> 
     <file>custom_abc_templates/customTemplate.html</file> // this specifies the path where the custom template is located 
     <type>html</type> 
    </custom_abc_email_template> 
    </email> 
</template> 

Code meiner Controller-Aktion

$emailTemplate = Mage::getModel('core/email_template')->loadDefault('custom_abc_email_template'); 
$emailTemplate->setSenderName('custom template'); 
$emailTemplate->setSenderEmail('[email protected]'); 
$emailTemplate->send('[email protected]','Forgot Password'); 

My Template-Datei Code

<table cellpadding="0" cellspacing="0" border="0"> 
    <tr> 
     <td class="action-content"> 
      <h1>Custom Abc,</h1> 
      <p><strong>Your new password is:</strong> trolled</p> 
      <p>You can change your password at any time by logging into <a href="{{store url="customer/account/"}}">your account</a>.</p> 
     </td> 
    </tr> 
</table> 

In exception.log

2016-04-11T10:03:18+00:00 ERR (3): exception 'Exception' with message 
'This letter cannot be sent.' in /var/www/html/MMM/app/code/local/Aschroder/SMTPPro/Model/Email/Template.php:40 

In aschroder_smtppro.log

2016-04-11T10:03:18+00:00 DEBUG (7): Email is not valid for sending, 
this is a core error that often means there's a problem with your email templates. 

Einstellung von E-Mail in Backend enter image description here

Antwort

0

Verwendung dieser Vorlage

<table cellpadding="0" cellspacing="0" border="0"> 
<tr> 
    <td class="action-content"> 
     <h1>Custom Abc,</h1> 
     <p><strong>Your new password is:</strong> trolled</p> 
     <p>You can change your password at any time by logging into <a href="{{store url='customer/account/'}}">your account</a>.</p> 
    </td> 
</tr> 

0

Die gleiche Ausnahme mit der Änderung der E-Mail-Einstellung des Magento-Systems wurde behoben. Die Ausnahme wird im E-Mail-Vorlagencode des Plugins festgelegt (siehe unten).

Im Admin wählen Sie System -> Konfiguration aus dem Hauptmenü, und gehen Sie zu System - Mail-Sendeeinstellungen. Stellen Sie "E-Mail-Kommunikation deaktivieren" auf "Nein".

if (!$this->isValidForSend()) { 
    $_helper->log('Email is not valid for sending, this is a core error that often means there\'s a problem with your email templates.'); 
    Mage::logException(new Exception('This letter cannot be sent.')); // translation is intentionally omitted 
    return false; } 
Verwandte Themen