Showing posts with label newsletter queue not sent problem. Show all posts
Showing posts with label newsletter queue not sent problem. Show all posts

magento newsletter queue not sending

By default cron is disable .so you need to enable the cron file on your cpanel server. and than you are be able to send the newsletter email in magento . below is the step which tell you how to add cron and solve magento newsletter queue not sending problem.


Step1:- set the cron file on cpanel server.

set this command on your cron file.
php5-cli -f /home/USERNAME/public_html/cron.php

and set the cron time.

Step2:- Change the file in 2 place  By default magento send newsletter subcription mail to 20

reciepient.


/public_html/app/code/core/Mage/Adminhtml/controllers/Newsletter

see this $countOfSubscritions or LINE no. 173 change your reciepient here.
 $countOfSubscritions = 4000; // i set here 4000 reciepient

if you want cron proceed more than 3 quee than change here
$countOfQueue  = 5;
 // i set here 5 Quee proceed



Step3:- see this $countOfSubscritions or LINE no. 62 change your reciepient here.

 $countOfSubscritions = 4000; // i set here 4000 reciepient

and wait for cron execution our newsletter.

custom add newsletter subscribe user in magento

If you want to add programmatically subscriber newsletter user in magento . than do not worry magento blog or magento tutorials will tell you how to add  custom subscriber newsletter user in magento.

Note:- Please take a Data Base Backup before usingthis script.

Step1:- Create a file subscriber.php in root folder.

Step2:- Add below code on subscriber.php file


<?php
require_once("app/Mage.php");
Mage::app();

$subscribers = array('put_your_subscriber_email_1', 'put_your_subscriber_email_2');

foreach ($subscribers as $email) {
  
    Mage::getModel('newsletter/subscriber')->setImportMode(true)->subscribe($email);
// Here we will create subscribe without send confirmation mail to  user


    $subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
// Here we reterive genetared subscribe.

  
    $subscriber->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED);
    $subscriber->save(); // Here we saved genetared subscribe.
}
?>


Step3:- clear cache and run this file on your browser
http://yoursite.com/subscribe.php