0

我正在使用 cakephp,并使用 smtp 通过 cakeemail 发送电子邮件。我的主机在 1and1.com。电子邮件将在 gmail 上发送,但不会在 yahoo 和 hotmail 上发送。

然后我在同一台服务器上尝试了 PHPMailer,它的电子邮件也将通过 gmail 和 hotmail 传递。但不幸的是,我无法将 PHPMailer 与 cakephp 一起使用。我尝试了两个教程但失败了。其中之一在这里

如果有人可以对此提供帮助,我更愿意使用 cakeemail 解决问题。

或者,如果可以使用 PHPMailer for cakephp 获得解决方案,也可以。

这是我的代码

                $email = new CakeEmail();  
                $email->smtp = array(
                     'port'=>'25',
                     'timeout'=>'30',
                     'host' => 'smtp.1and1.com',
                     'username'=>'quote@xxxxxx.com',
                     'password'=>'xxxxxx_',
                     'client' => 'smtp.1and1.com' ,
                     'transport' => 'Smtp'
                );

                $email->from(array('xxxx@a-xxxx.com' => 'A-Best Auto Parts Quote')); 
                $email->to("xxxx@yyy.com");
                //$email->bcc("xxxx@yyy.com");
                $email->subject('My Test Subject');
                $email->emailFormat('html');                
                $body="the test message for email"
                $email->send($body);
4

0 回答 0