问题描述
我是 SMTP
, sendmail
和 mail()的陌生人
I'm new to
SMTP
, sendmail
, and mail()
function in php codeigniter.
我正在尝试在我的codeigniter应用程序中配置SMTP邮件协议。进行所有设置,SMTP端口,发件人邮件,用户ID,单个用户的密码,即
admin@example.com
。
I'm trying to configure SMTP mail protocol in my codeigniter application. Make all settings, SMTP port, sender mail, user id, password for single user i.e.
admin@example.com
. It working fine.
我的问题是,可以在单个应用程序中设置两个SMTP用户帐户吗?
My question is, it is possible to setup two SMTP user account in single application ?
例如,我要设置
info @ example
.com和 admin@example.com
,因此这两个用户可以将邮件发送给客户。
For example I want to set
info@example
.com and admin@example.com
, so these two users can send mails to customers.
推荐答案
您只能通过更改config来使用它,例如
You can use it by only changes in config : as like
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => 'xxx', // First user authenticate
'smtp_pass' => 'xxx',
'mailtype' => 'html',
'charset' => 'iso-8859-1'
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
// Set to, from, message, etc.
$result = $this->email->send();
和
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => 'yyy', // Second user authenticate
'smtp_pass' => 'zzzz',
'mailtype' => 'html',
'charset' => 'iso-8859-1'
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
// Set to, from, message, etc.
$result = $this->email->send();
但只有一件事,就是您必须在服务器上配置两个邮件用户。谢谢
But only one thing is that you have to configure your both mail user at server. Thanks
这篇关于如何在codeigniter应用程序中配置SMTP?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!