I want to send the product stock alert mail from outside magento app folder.

How will i access the email object for that outside magento?

I have already bootstrapped Mage.php file

$storeId = Mage::app()->getStore()->getId();
$templateId = 'product_stock_alert';

$emailTemplate = Mage::getModel('core/email_template')->loadByCode($templateId);
//$vars = array('user_name' => $userName, 'product_name' => $productName);
$emailTemplate->setSenderEmail(Mage::getStoreConfig('trans_email/ident_general/email', $storeId));

$emailTemplate->setSenderName(Mage::getStoreConfig('trans_email/ident_general/name', $storeId));

    foreach ($emails as $email) {
        if (in_array($email['product_id'], $qty)) {

EDIT:Any clue at least where to start checking on this?

1 Answer 1


Try the below.... Mage::getModel('productalert/observer')->process(); is used for stock /price alert mail. If you want to only send product stock alert then use

Goto to app/code/core/Mage/ProductAlert/Model/Observer.php make processStock type protected to public...After that

$email = Mage::getModel('productalert/email');

See more it code goes to app/code/core/Mage/ProductAlert/Model/Observer.php

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.