0
私はcodeigniterのループで電子メールを送信しています。 実際に何が起こっているのですか?私は電子メールを受信していますが、それは私が含まれていたメッセージを振っていません。続いてスクリプトです:Codeigniter - 電子メールを受信しましたが、電子メールで送信したメッセージを受信しません。
<?php
Class Email extends CI_Controller
{
function __construct()
{
parent::__construct();
}
function index()
{
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => 'myemail',
'smtp_pass' => 'mypass',
'mailtype' => 'html',
'charset' => 'iso-8859-1',
'send_multipart' => FALSE
);
$this->load->library('email', $config);
$this->load->database();
$query = $this->db->query('SELECT email FROM users');
// $this->email->initialize($config);
// $this->email->set_newline('\r\n');
foreach ($query->result() as $row)
{
$this->email->clear();
$this->email->set_newline("\r\n");
$this->load->library('email',$config);
$this->email->from("mymail","myname");
$this->email->to($row->email);
$this->email->subject("THIS IS AN EMAIL TEST");
$this->email->message('Hello, We are <strong>Example Inc.</strong>');
$this->email->set_mailtype("html");
if($this->email->send())
{
echo "Your Mail send";
}
else
{
show_error($this->email->print_debugger());
}
}
echo 'Total Results: ' . $query->num_rows();
}
}
?>
私はHello, We are <strong>Example Inc.</strong>'
電子メールでこのメッセージを期待していますが、私が実際に取得することは
メールではありませんメッセージを指定です。どこで私は間違っている。
であなたのコード 'html'タグを削除し、チェックを交換してください。削除 ' –
htmlタグの削除は機能しません。私がビューフォルダに任意のページテンプレートストアを渡している場合、それはうまく動作します。しかし、文字列を 'message()'にメッセージとして渡していれば、それは動作しません。 'send_multipart'がfalseであるのはなぜですか? –
このコードをforeachループの内側から削除する$ this-> load-> library( 'email'、$ config);あなたは既にループの外側にメールライブラリをロードしているので、 –