- Log in to post comments
#!/usr/bin/php
<?php
require_once("/var/www/app/Mage.php");
Mage::app();
# read from magento collection
$collection = Mage::getResourceModel('newsletter/subscriber_collection')->load();
foreach($collection->getItems() as $subscriber) {
echo strtolower($subscriber->getSubscriberEmail()) . "\n";
}
# read from custom table
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
$sql = "select subscriber_confirm_code from newsletter_subscriber where subscriber_confirm_code is not null";
$rows = $connection->fetchAll($sql);
foreach($rows as $row) {
echo $row["subscriber_confirm_code"] . "\n";
}
?>