0

i got this error

Fatal error: Uncaught exception 'Exception' with message 'Warning: simplexml_load_string(): Entity: line 41: parser error : StartTag: invalid element name in public_html/lib/Varien/Simplexml/Config.php on line 383' in public_html/app/code/core/Mage/Core/functions.php:245 Stack trace: #0 [internal function]: mageCoreErrorHandler(2, 'simplexml_load_...', '/p...', 383, Array) #1 /public_html/lib/Varien/Simplexml/Config.php(383): simplexml_load_string('loadCache() #3 /public_html/app/code/core/Mage/Core/Model/Config.php(255): Mage_Core_Model_Config->loadModulesCache() #4 /public_html/app/code/core/Mage/Core/Model/App.php(277): Mage_Core_Model_Config->init(Array) #5 /public_html/app/Mage.php(616): Mage_Core_Model_App->init('', 'store', Array) #6 /public_html/sendmail.php(6): Mage: in /public_html/app/code/core/Mage/Core/functions.php on line 245

Using this script

<?php
ini_set('display_errors',true);
include 'app/Mage.php';
Mage::setIsDeveloperMode(true);

Mage::app();

$coll = Mage::getResourceModel('customer/customer_collection');

$coll->addFieldToFilter('group_id',1);


foreach ($coll as $customer) {
$customer->setForceConfirmed(true);
$sendPassToEmail = true;
$customer->setPassword($customer->generatePassword());
$customer->save();
$customer->sendNewAccountEmail('registered', '',
$customer->getStoreId());
}
0

As this isn't real fix of your issue but, as it is still a warning, not real fatal error (this fatal is due to uncaught exception), you can temporary hide xml warnings by using this line right after ini_set

libxml_use_internal_errors(true);

Question: why you don't use shell script extending Mage_Shell_Abstract class? It's easy to implement only one method run().

  • can you give me a example for send bulk email to all users – Dhinakar Aug 25 '16 at 10:03
0

I'm not fan of bulk mailing 15k unique customers using Zend_Mail but here you go:

    /** Returns mail transport object
     * @param $email
     * @param $name
     * @param $templateId
     * @param $emailTemplateVariables
     * @return Mage_Core_Model_Email_Template_Mailer
     */
    protected function getMailObj($email, $name, $templateId, $emailTemplateVariables = array())
    {
        $emailInfo = Mage::getModel('core/email_info');
        $emailInfo->addTo($email, $name);
        /** @var $mailObject Mage_Core_Model_Email_Template_Mailer */
        $mailObject = Mage::getModel('core/email_template_mailer');
        $mailObject->addEmailInfo($emailInfo);
        $mailObject->setSender(
            array(
                'email' => Mage::getStoreConfig('trans_email/ident_general/email'),
                'name' => Mage::getStoreConfig('trans_email/ident_general/name')
            )
        );
        $mailObject->setTemplateId($templateId);
        $mailObject->setTemplateParams($emailTemplateVariables);

        return $mailObject;
    }

    /** Send new email
     * @return Mage_Core_Model_Email_Template_Mailer
     */
    public function sendEmail($email, $name, $surname, $mailTemplateId)
    {
        $mail = $this->getMailObj(
            $email,
            $name . ' ' . $surname,
            $mailTemplateId,
            // these are optional parameters passed to your email template
            /*
            array(
                'test1' => 'testa',
                'test2' => 'testb'
            )
            */
        );

        return $mail->send();
    }

Where $mailTemplateId is your email template Id created in magento backend. To add another email to queue use: addEmailInfo method before sending.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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