Php 在codeigniter中发送电子邮件
要发送电子邮件,我将配置设置如下Php 在codeigniter中发送电子邮件,php,codeigniter,Php,Codeigniter,要发送电子邮件,我将配置设置如下 $config['protocol'] = 'smtp'; $config['charset'] = 'iso-8859-1'; $config['wordwrap'] = TRUE; $this->email->subject('Email Test'); $this->email->message('Testing the email class.'); $this->email->send(); 我的outlook
$config['protocol'] = 'smtp';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
$this->email->send();
我的outlook电子邮件帐户smtp设置为
mail.mycompany.com
我从该帐户向任何其他帐户发送电子邮件时出错。我忘记了错误消息,现在无法在这台计算机上复制它,但是看看那些配置,你认为它正确吗?(在调用函数send发送电子邮件之前,我还包括了对其初始值设定项的调用或加载其库以便在控制器构造函数中使用的调用)。确定,尝试使用协议sendmail
$config['protocol'] = 'sendmail';
$config['mailpath'] = '/usr/sbin/sendmail';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;
$this->email->initialize($config);
如果使用smtp协议,则需要定义smtp参数:
$config['smtp_host']
$config['smtp_user']
$config['smtp_pass']
然后
你看起来棒极了。无论您的问题是什么,您都应该始终添加错误消息,否则如果不是很明显,没有人能够帮助您。您的配置文件中有SMTP服务器、用户名和密码,对吗?您是否在Mamp或Wamp中脱机执行所有这些操作?
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
$this->email->send();
echo $this->email->print_debugger();