Search code examples
magentomagento-1.9reset-password

magento email sending programmatically


I am trying to use following code to send recovery email. But it never send email? any suggestion? I am using 1.9 version magento.

if ($customer->getId()) 
{
    try
    {
        $newResetPasswordLinkToken =  Mage::helper('customer')->generateResetPasswordLinkToken();
        $customer->changeResetPasswordLinkToken($newResetPasswordLinkToken);
        $customer->save();
        $customer->sendPasswordResetConfirmationEmail();
    }
    catch (Exception $exception) 
    {

    }
}

Solution

  • I have installed Postfix mail server. And I have added following line with crontab -e * * * * * sh /var/www/html/cron.sh Then it works fine.