0
我想在codeignitor控制器中發送電子郵件。我已經使用foreach循環體內多個附件。但它不起作用。給我一些建議 這裏是我的控制器功能。如何在codeignitor電子郵件中使用foreach循環發送
function emailSend($ship_item_data{
//$link = base_url();
$email ="[email protected]";
$this->load->library('email');
$config['mailtype'] = "html";
$this->email->initialize($config);
$this->email->from($email, 'GHL Sports');
$this->email->to($email);
$this->email->subject('Sold items detail');
$msg='<html>
<head>
<title>Sold item</title>
</head>
<body>
Dear GHL Sports Client.
<p>This items heas been sold.</p><ul>';
foreach($ship_item_data as $data){
$item = $data['image_name'];
$this->email->attach("sold/".$item);
$msg .= '<li>'. $item .'</li>';
}
$msg .='</u>
Please do reply to this email as it will not be monitored.
</body>
</html>';
$this->email->message($msg);
//$link = base_url();
//$this->email->attach("sold/1.jpg");
//Send mail
if($this->email->send()) {
echo "email send successfully";
}else{
echo "email not send";
}
我還在構造函數中包含電子郵件庫。
$this->load->helper('path');
$this->load->library('email');
看看這個問題http://stackoverflow.com/questions/15090421/codeigniter-attaching-2-files-to-email-that-have-been-uploaded-from-user-form – shantanu