本文整理汇总了PHP中Emails::getDistrictEmails方法的典型用法代码示例。如果您正苦于以下问题:PHP Emails::getDistrictEmails方法的具体用法?PHP Emails::getDistrictEmails怎么用?PHP Emails::getDistrictEmails使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Emails
的用法示例。
在下文中一共展示了Emails::getDistrictEmails方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: email_sender
function email_sender($report_name, $start_date, $end_date, $district_or_region, $vals, $store)
{
//setting the connection variables
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.googlemail.com';
$config['smtp_port'] = 465;
$config['smtp_user'] = stripslashes('D.V.I.VaccinesKenya@gmail.com');
$config['smtp_pass'] = stripslashes('projectDVI');
ini_set("SMTP", "ssl://smtp.gmail.com");
ini_set("smtp_port", "465");
ini_set("max_execution_time", "50000");
if ($vals == 1) {
$emails = Emails::getProvinceEmails($district_or_region);
} else {
if ($vals == 2) {
$emails = Emails::getDistrictEmails($district_or_region);
} else {
if ($vals == 3) {
$emails = Emails::getEmails();
}
}
}
//pulling emails from the DB
$this->load->library('email', $config);
$path = $_SERVER["DOCUMENT_ROOT"];
$file = $path . "/DVI/application/pdf/" . $report_name;
//puts the path where the pdf's are stored
foreach ($emails as $email) {
$this->email->attach($file);
$address = $email['email'];
$this->email->set_newline("\r\n");
$start_text_date = date("M j, Y", strtotime($start_date));
$end_text_date = date("M j, Y", strtotime($end_date));
$this->email->from('D.V.I.VaccinesKenya@gmail.com', "DVI MAILER");
//user variable displays current user logged in from sessions
$this->email->to("{$address}");
$this->email->subject("{$store}" . ' MONTHLY REPORT.');
$this->email->message('Please find the Report Attached for ' . "{$store}" . ' Period of ' . "{$start_text_date}" . ' to ' . "{$end_text_date}");
//success message else show the error
if ($this->email->send()) {
echo 'Your email was sent, successfully to ' . $address . '<br/>';
//unlink($file);
$this->email->clear(TRUE);
} else {
show_error($this->email->print_debugger());
}
}
ob_end_flush();
unlink($file);
//delete the attachment after sending to avoid clog up of pdf's
}