我在联系表单的控制器中使用了以下代码。
public function index()
{
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => 'email@mydomain.com',
'smtp_pass' => 'myPassword',
'mailtype' => 'html',
'charset' => 'iso-8859-1'
);
我可以在不使用“smtp_user”和“smtp_pass”的情况下发送电子邮件吗?
答案 0 :(得分:1)
只需在配置中使用mail
协议即可。
请参阅文档:http://ellislab.com/codeigniter/user-guide/libraries/email.html
您可以使用默认配置并发送电子邮件,如:
$this->load->library('email');
$this->email->from('your@example.com', 'Your Name');
$this->email->to('someone@example.com');
$this->email->cc('another@another-example.com');
$this->email->bcc('them@their-example.com');
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
$this->email->send();
echo $this->email->print_debugger();