I would like to send an email notification to my store\'s contact email address every time when a new customer has been Registered.
I don\'t want to purchase any kin
Best practice is to use Magento's event system.
app/etc/modules/Your_Module.xml
true
local
app/core/local/Your/Module/etc/config.xml
Your_Module_Model
model
your_module/observer
customerSaveAfter
app/code/local/Your/Module/Model/Observer.php
getCustomer()->getData();
//email address from System > Configuration > Contacts
$contactEmail = Mage::getStoreConfig('contacts/email/recipient_email');
//Mail sending logic here.
/*
EDIT: AlphaCentauri reminded me - Forgot to mention that
you will want to test that the object is new. I **think**
that you can do something like:
*/
if (!$o->getCustomer()->getOrigData()) {
//customer is new, otherwise it's an edit
}
}
}
EDIT: Note the edit in the code - as AlphaCentauri pointed out, the customer_save_after
event is fired for both inserts and updates. The _origData
conditional logic should allow you to incorporate his mailing logic. _origData will be null
.