CakePHP SMTP 电子邮件无法在服务器上运行
我可以在 CakePHP 中从本地服务器发送 SMTP 电子邮件,但无法在 CakePHP 中的 GoDaddy 实时服务器上执行相同操作。
有什么相同的想法吗?
谢谢
根据我在 GoDaddy 的经验,答案如下:
下面的代码在 GoDaddy 服务器上使用 CakePHP SMTP 电子邮件为我工作:
配置文件夹内的 Email.php 文件 - CakePHP 2.4 MVC版本:
// for Live Server GoDaddy.com domain
public $smtp = array(
'transport' => 'Smtp',
'host' => 'ssl://smtpout.asia.secureserver.net', // important
'port' => 465, // important
#'timeout' => 30,
'username' => '[email protected]',
'password' => 'password',
#'tls' => false,
#'log' => false,
'charset' => 'utf-8',
'headerCharset' => 'utf-8',
);
这是下面的控制器文件代码:
// Controller Code to Send Actual Email
// email configuration
$Email = new CakeEmail('smtp');
$Email->from(array('[email protected]' => 'App Name'))
->sender('[email protected]', 'App Name')
->to(array($email))
->bcc(array('[email protected]'))
->subject('Test Email from GoDaddy')
->emailFormat('both')
->send($hash.'<br><strong>My</strong> message 45 قبل الميلاد، مما يجعله أكثر من');
希望它有帮助!
谢谢
I am able to send SMTP Emails from my local server machine in CakePHP while I am not able to do the same on my GoDaddy live server, in CakePHP.
Any ideas for the same?
Thanks
Answer is below as per my experience with GoDaddy:
Below code is working for me over GoDaddy server using CakePHP SMTP Email:
Email.php file inside config folder - CakePHP 2.4 MVC version:
// for Live Server GoDaddy.com domain
public $smtp = array(
'transport' => 'Smtp',
'host' => 'ssl://smtpout.asia.secureserver.net', // important
'port' => 465, // important
#'timeout' => 30,
'username' => '[email protected]',
'password' => 'password',
#'tls' => false,
#'log' => false,
'charset' => 'utf-8',
'headerCharset' => 'utf-8',
);
And here is the controller file code below:
// Controller Code to Send Actual Email
// email configuration
$Email = new CakeEmail('smtp');
$Email->from(array('[email protected]' => 'App Name'))
->sender('[email protected]', 'App Name')
->to(array($email))
->bcc(array('[email protected]'))
->subject('Test Email from GoDaddy')
->emailFormat('both')
->send($hash.'<br><strong>My</strong> message 45 قبل الميلاد، مما يجعله أكثر من');
Hope it helps !
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
更新代码以检查错误消息:
然后检查服务器上的 /app/tmp/logs/debug 文件。
Update your code to check for an error message:
Then check the /app/tmp/logs/debug file on the server.