CakePHP-2.0:如何使用CakEmail和SMTP设置从gmail帐户发送电子邮件? [英] CakePHP-2.0: How can i send email from a gmail account using CakEmail and SMTP setting?
问题描述
我正在尝试使用CakEmail和SMTP设置从gmail帐户发送电子邮件。
I'm trying to send email from a gmail account using CakEmail and SMTP settings .
如果有人逐步告诉过程,该怎么办。
It would be nice if someone tell the process step by step what to do .
我已在app / Config / email.php =>
I have added the following in app/Config/email.php=>
<?php
class EmailConfig {
public $smtp = array(
'host' => 'ssl://smtp.gmail.com',
'port' => 465,
'username' => 'my@gmail.com',
'password' => 'secret'
);
}
现在我如何从我的@ gmail发送电子邮件到任何电子邮件帐户。 com?
Now how can i send email to any email account from "my@gmail.com" ?
它是CakePHP-2.0
It's CakePHP-2.0
推荐答案
从文档:
您可以配置SSL SMTP服务器,如GMail。为此,请将ssl://作为前缀放在主机中,并相应地配置端口值。示例:
You can configure SSL SMTP servers, like GMail. To do so, put the 'ssl://' at prefix in the host and configure the port value accordingly. Example:
<?php
class EmailConfig {
public $gmail = array(
'host' => 'ssl://smtp.gmail.com',
'port' => 465,
'username' => 'my@gmail.com',
'password' => 'secret'
);
}
http://book.cakephp.org/2.0/en/core-utility-libraries/email.html?highlight=cakeemail#CakeEmail
这篇关于CakePHP-2.0:如何使用CakEmail和SMTP设置从gmail帐户发送电子邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!