cakephp 2.0 smtp电子邮件 [英] cakephp 2.0 smtp email

查看:341
本文介绍了cakephp 2.0 smtp电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用CakePhp 2.0发送电子邮件.在我的控制器中,我使用此代码(我知道这很好,我从

I am trying to send a email message using CakePhp 2.0. in my controller i use this code (i know it's fine, i took it from the cookbook) :

App::uses('CakeEmail', 'Network/Email');
$email = new CakeEmail("myConfig");
$email->from(array('from@example.com' => 'From Example'));
$email->to($to);
$email->subject($msgtitle);
$ok = $email->send($content);

并且在app/config/email.php中,我具有以下配置:

and in app/config/email.php i have this config :

<?php
class EmailConfig {
    public $myConfig = array(
        'host' => 'mail.myServer.com',
        'port' => 587,
        'username' => 'mYaccount',
        'password' => 'secret',
        'transport' => 'Smtp'
    );
}
?>

问题是服务器回答:

SMTP Error: 530 5.7.0 Must issue a STARTTLS command first.

帐户名正确,密码正确.将配置文件加载到雷鸟中时,该配置文件有效,与smtp服务器的连接设置为:

the account name is correct, as is the password. The config works when loading it up in thunderbird, the connection to the smtp server is set up as :

服务器名称:mail.myServer.com
端口:587
连接安全性:STARTTLS
身份验证:普通密码
用户名:mYaccount

server name : mail.myServer.com
port : 587
connection security : STARTTLS
authentication : normal password
user name : mYaccount

推荐答案

您确定您的SMTP支持tls吗?尝试发送ehlo命令:

Are you certain your SMTP supports tls? Try sending the ehlo command:

telnet 1.2.3.4 25
ehlo testing

您应该看到类似的内容:

You should see something like:

250-STARTTLS

列表中的

.

in the list.

如果看到它,则很可能未启用它.您将需要启用它.如果看不到它,则需要添加它.

If you see it, then it is most likely not enabled. You will need to enable it. If you do not see it, you will need to add it.

这篇关于cakephp 2.0 smtp电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆