我試圖在通過我的項目發送郵件時將圖像附加到我的電子郵件中......到目前爲止,我正在成功地從下面的代碼發送電子郵件。是我應該使用添加附件到這個(添加圖像)的變化......請幫我用cordelgniter如何在發送電子郵件時附上圖像php
public function sendMailToComplete($ID) {
$this->load->model('get_db');
$customers = $this->get_db->getBirthdays();
$this->get_db->updateGreetingStatus();
if (empty($customers)) {
return;
}
foreach ($this->get_db->getEmailConfig() as $row) {
$config = array(
'protocol' => $row->protocol,
'smtp_host' => $row->host,
'smtp_user' => $row->user,
'smtp_pass' => $row->pass,
'smtp_port' => $row->port,
'smtp_timeout' => $row->timeout,
'mailtype' => $row->mailtype,
'charset' => $row->charset
);
$this->load->library('email', $config);
foreach ($customers as $customer) {
$email = $customer['email'];
$this->email->clear();
$this->email->set_newline("\r\n");
$this->email->from($row->from, 'ABC');
$this->email->to($email);
$this->email->subject('Birthday Greetings');
$this->email->message('Many Happy Returns of the day...');
$this->email->send();
}
$this->email->clear();
}
}
function getBirthdays()
{
$query = $this->db->query("select ci.* from customer_info ci where month(b_day) = month(curdate()) and day(b_day) = day(curdate());");
return $query->result_array();
}
滾動到https://ellislab.com/codeigniter/user-guide/libraries/email.html底部 – JimL
哦謝謝你我會試試這個.. – Akisha
不..我試過這個,但這是沒有附加任何圖像到我的電子郵件 – Akisha