i need to create a custom mailing script in magento in Shell folder. I got the sample script from internet. this script was described as a stand alone script and no template id's are required and this type of script is what I needed and program didn't work for me.
Below is the script.

require '../app/Mage.php';
ini_set('display_errors', true);
ini_set('max_execution_time', 3600); // just put a lot of time
ini_set('default_socket_timeout', 3600); // same

    class Mage_Shell_Report
            public function myfunc()
                $body = "Hi there, here is some plaintext body content";
                $mail = Mage::getModel('core/email');
                $mail->setSubject('The Subject');
                $mail->setType('text');// You can use 'html' or 'text'

                try {
                        $msg = true;
                        echo "<br>mail sent<br>";
                        echo "<br>mail not send<br>";

                    Mage::getSingleton('core/session')->addSuccess('Your request has been sent');
                catch (Exception $e) {
                    Mage::getSingleton('core/session')->addError('Unable to send.');
                echo "<br>end program<br>";
    echo "out-1";
    $shell1 = new Mage_Shell_Report();

This program shows no error . Though mail function returns success , i am not receiving any mail. i am testing in local using SMTP. Other email's, like order email, customer emails are sent successfully and can be viewed in SMTP mailbox.

I browsed through pages and came to know that this issue has something to do with queuing but am not clear about that.
Kindly help me out

Your Answer

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

Browse other questions tagged or ask your own question.