我的代码:
$config['protocal'] = 'smtp';
$config['mail_path'] = 'ssl://smtp.googlemail.com';
$config['smtp_host'] = 'ssl://smtp.googlemail.com';
$config['smtp_port'] = 465;
$config['smtp_user'] = 'mygmail@gmail.com';
$config['smtp_pass'] = 'mypass!';
$config['charset'] = "utf-8";
$config['mailtype'] = "html";
$this->load->library('email', $config);
$config['newline'] = "\r\n";
$this->email->initialize($config);
$this->load->library('email');
$this->email->from('info@maaden.com.sa','Blowing Notification');
$this->email->to('eduardodbarrete@gmail.com');
$this->email->cc('eduardobarrete@gmail.com');
$this->email->subject('Whistle Receipt');
$message = "<p> Thank you for the report you submitted </p>";
$message .= "<p> Report ID: <strong>" . $session_id . "</strong></p>";
$message .= "<p> Your Email: <strong>" . $this->input->post('email') . "</strong></p>";
$this->email->message($message);
$this->email->send();
echo $this->email->print_debugger();
print_dubugger();输出如下;
Your message has been successfully sent using the following protocol: mail
User-Agent: CodeIgniter
Date: Tue, 8 Oct 2013 12:13:46 +0300
From: "Blowing Notification"
Return-Path:
Cc: email.com.sa
Reply-To: "no-reply@email.com"
X-Sender: no-reply@email.com
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <5253ccca8ee37@email.com.sa>
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="B_ALT_5253ccca8eeae"
在上面的print_debugger();输出我没有看到任何&#34; To&#34;我的电子邮件应该放在哪里也许是我没有收到任何电子邮件的原因。感谢
答案 0 :(得分:0)
您需要像下面这样配置您的smtp服务器信息:
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => '465',
'smtp_user' => 'someuser@gmail.com',
'smtp_pass' => 'password',
'mailtype' => 'html',
'starttls' => true,
'newline' => "\r\n"
);
$this->load->library('email', $config);
$this->email->from('someuser@gmail.com', 'invoice');
$this->email->to('test@test.com');
$this->email->subject('Invoice');
$this->email->message('Test');
$this->email->send();