當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Emails::getDistrictEmails方法代碼示例

本文整理匯總了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
 }
開發者ID:EuniceManyasi,項目名稱:DVI,代碼行數:51,代碼來源:auto_email.php


注:本文中的Emails::getDistrictEmails方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。