<?php require_once 'app/Mage.php'; umask( 0 ); Mage :: app( "default" ); //$_helper = new Mage_Newsletter_Model_Subscriber(); //$_helper->subscribe("myemail@e-mail.co.uk"); $emails = array("myemail4@e-mail.co.uk","myemail5@e-mail.co.uk","myemail6@e-mail.co.uk"); foreach($emails as $email){ $db = Mage::getSingleton('core/resource')->getConnection('core/write'); $query = "SELECT * FROM newsletter_subscriber WHERE subscriber_email = '$email'"; $result = $db->query($query); if($result->fetchAll()): echo "Email Not Added: $email<br/>"; else: $db->query("INSERT INTO newsletter_subscriber (`subscriber_id` , `store_id` , `change_status_at` , `customer_id` , `subscriber_email` , `subscriber_status` , `subscriber_confirm_code`) VALUES (NULL,'1',NULL,'0','$email','1',NULL)"); echo "Email Successfully Added: $email<br/>"; endif; } ?>
No comments:
Post a Comment