My Custom Observer is not sending the email.
public function sendAdminMail(Varien_Event_Observer $observer)
{
$customer = $observer->getEvent()->getCustomer();
$customerName = $customer->getFirstname() . ' ' . $customer->getLastname();
$emailTemplate = Mage::getModel('core/email_template');
$template = "customer_registration_email_template";
$sender = array('name' => 'Customer Registration',
'email' => '[email protected]');
$recipientEmail = Mage::getStoreConfig('contacts/email/recipient_email');
$recipientName = "Sales";
$variables = array('customer'=>$customerName);
$emailTemplate->sendTransactional(
$template,
$sender,
$recipientEmail,
$recipientName,
$variables
);
}
Here is my config.xml (global node)
<template>
<email>
<customer_registration_email_template translate="label" module="adminnotification">
<label>Customer Registration Admin Notification</label>
<file>schott/customer_registration.html</file>
<type>html</type>
</customer_registration_email_template>
</email>
</template>
To be complete, here is the system.xml too
<config>
<label>Customer Registration Admin Notification</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_email_template</source_model>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</config>
An email should be sent to the admin when a new customer registers.
What am I doing wrong here? The template is showing in the list of Transactional mails in the backend and it sends when I use it testwise for new orders for example.
Strange is also, that the content of the template does not load in the backend (transactional mails) when I add a new template and want to load its default content (it just loads and stays blank).
Any help appreciated. Thanks in advance!