dqa35710 2015-06-30 06:48 采纳率: 0%
浏览 18

Magento自定义电子邮件在使用SMTP从shell文件夹(不在本地目录中)以编程方式在localhost中尝试时不发送

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
set_time_limit(0);

    class Mage_Shell_Report
    {
            public function myfunc()
            {           
                $body = "Hi there, here is some plaintext body content";
                $mail = Mage::getModel('core/email');
                $mail->setToName('reig');
                $mail->setToEmail('rieg.philippe@neuf.fr');
                $mail->setBody($body);
                $mail->setSubject('The Subject');
                $mail->setFromEmail('boutique@infosys.com');
                $mail->setFromName("divine");
                $mail->setType('text');// You can use 'html' or 'text'

                try {
                    $mail->send();
                    if($mail->send())
                    {
                        $msg = true;
                        echo "<br>mail sent<br>";
                    }
                    else 
                    {
                        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.');
                    $this->_redirect('');
                }       
                echo "<br>end program<br>";
            }
    }
    echo "out-1";
    $shell1 = new Mage_Shell_Report();
    $shell1->myfunc();
    ?>

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

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 @microsoft/fetch-event-source 流式响应问题
    • ¥15 ogg dd trandata 报错
    • ¥15 高缺失率数据如何选择填充方式
    • ¥50 potsgresql15备份问题
    • ¥15 Mac系统vs code使用phpstudy如何配置debug来调试php
    • ¥15 目前主流的音乐软件,像网易云音乐,QQ音乐他们的前端和后台部分是用的什么技术实现的?求解!
    • ¥60 pb数据库修改与连接
    • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
    • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
    • ¥20 神经网络Sequential name=sequential, built=False