当前位置: 首页>>代码示例>>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;未经允许,请勿转载。