当前位置: 首页>>代码示例>>PHP>>正文


PHP CI_Email::initialize方法代码示例

本文整理汇总了PHP中CI_Email::initialize方法的典型用法代码示例。如果您正苦于以下问题:PHP CI_Email::initialize方法的具体用法?PHP CI_Email::initialize怎么用?PHP CI_Email::initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CI_Email的用法示例。


在下文中一共展示了CI_Email::initialize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getMailer

 function getMailer()
 {
     $this->ci->load->library('email');
     $Email = new CI_Email();
     $Email->initialize(array('protocol' => 'smtp', 'smtp_host' => 'infizi.com', 'smtp_user' => 'no-reply@infizi.com', 'smtp_pass' => 'Kb}v]w[t%.@&', 'smtp_port' => '26', 'mailtype' => 'html'));
     return $Email;
 }
开发者ID:Swift-Jr,项目名称:thmdhc,代码行数:7,代码来源:mailer.php

示例2: initialize

 /**
  * Initialize preferences
  *
  * @param	array
  * @return	CI_Email
  */
 public function initialize($config = array())
 {
     $this->CI =& get_instance();
     $config['protocol'] = $this->CI->config->item('protocol');
     $config['smtp_host'] = $this->CI->config->item('smtp_host');
     $config['smtp_port'] = $this->CI->config->item('smtp_port');
     $config['smtp_user'] = $this->CI->config->item('smtp_user');
     $config['smtp_pass'] = $this->CI->config->item('smtp_pass');
     $config['newline'] = "\r\n";
     return parent::initialize($config);
 }
开发者ID:ududsha,项目名称:TastyIgniter,代码行数:17,代码来源:TI_Email.php

示例3: finalize_print

/** FINALIZE PRINT TASK 
 * 
 * @param $tid - TASK ID
 * @param $status - TASK STATUS (STOPPED - PERFORMED)
 * 
 **/
function finalize_print($tid, $status)
{
    //global $log;
    //$log->info('Task #'.$tid.' print '.$status);
    //$log->info('Task #'.$tid.' start finalizing');
    //LOAD DB
    $db = new Database();
    //GET TASK
    $task = $db->query('select * from sys_tasks where id=' . $tid);
    $reset = false;
    //CHECK IF TASK WAS ALREARDY FINALIZED
    if ($task['status'] == 'stopped' || $task['status'] == 'performed') {
        //$log->info('Task #'.$tid.' already finalized. Exit');
        return;
    }
    //GET TASK ATTRIBUTES
    $attributes = json_decode($task['attributes'], TRUE);
    $print_type = $attributes['print_type'];
    if ($status == 'stopped' && $print_type == 'additive') {
        //IF % PROGRESS IS < 0.5 FOR SECURITY REASON I RESET THE BOARD CONTROLLER
        $monitor = json_decode(file_get_contents($attributes['monitor']), TRUE);
        $percent = $monitor['print']['stats']['percent'];
        if ($percent < 0.2) {
            /** FORCE RESET CONTROLLER */
            $_command = 'sudo python ' . PYTHON_PATH . 'force_reset.py';
            shell_exec($_command);
            $reset = true;
            //$log->info('Task #'.$tid.' reset controller');
        }
    }
    //GET TYPE OF FILE (ADDITIVE OR SUBTRACTIVE) FOR ENDING MACRO
    $file = $db->query('select * from sys_files where id=' . $attributes['id_file']);
    //UPDATE TASK
    update_task($tid, $status);
    $_macro_end_print_response = TEMP_PATH . 'macro_response';
    $_macro_end_print_trace = TEMP_PATH . 'macro_trace';
    /*
    if(($file['print_type'] == 'additive') && !$reset){
    	echo 'sudo python '.PYTHON_PATH.'gmacro.py end_print_additive_safe_zone '.$_macro_end_print_trace.' '.$_macro_end_print_response.' > /dev/null &';
    	shell_exec('sudo python '.PYTHON_PATH.'gmacro.py end_print_additive_safe_zone '.$_macro_end_print_trace.' '.$_macro_end_print_response.' > /dev/null &');
    }
    */
    $end_macro = $file['print_type'] == 'subtractive' ? 'end_print_subtractive' : 'end_print_additive';
    write_file($_macro_end_print_trace, '', 'w');
    chmod($_macro_end_print_trace, 0777);
    write_file($_macro_end_print_response, '', 'w');
    chmod($_macro_end_print_response, 0777);
    //EXEC END MACRO
    shell_exec('sudo python ' . PYTHON_PATH . 'gmacro.py ' . $end_macro . ' ' . $_macro_end_print_trace . ' ' . $_macro_end_print_response . ' > /dev/null &');
    //$log->info('Task #'.$tid.' end macro: '.$end_macro);
    sleep(2);
    shell_exec('sudo kill ' . $attributes['pid']);
    // SEND MAIL
    if (isset($attributes['mail']) && $attributes['mail'] == 1 && $status == 'peformed') {
        $user = $db->query('select * from sys_user where id=' . $task['user']);
        // CREATE IMAGE TO SEND
        write_file($attributes['folder'] . 'print.jpg', '', 'w');
        chmod($attributes['folder'] . 'print.jpg', 0777);
        // TAKE PICTURE
        shell_exec('sudo raspistill -hf -vf -rot 90  --exposure off -awb sun -ISO 400 -w 768 -h 1024 -o ' . $attributes['folder'] . 'print.jpg' . '  -t 0');
        $email = new CI_Email();
        $config['mailtype'] = 'html';
        $email->initialize($config);
        $email->from('noreplay@fabtotum.com', 'Your Personal Fabricator - Fabtotum');
        $email->to($user['email']);
        // ATTACH
        $email->attach($attributes['folder'] . 'print.jpg');
        $email->subject('Your print is finished');
        $message = 'Dear <strong>' . ucfirst($user['first_name']) . '</strong>,<br>i want to inform you that the print is finished right now';
        $email->message($message);
        if (!$email->send()) {
            //$log->error('Task #'.$tid.' mail sent to '.$user['email']);
        } else {
            //$log->info('Task #'.$tid.' mail sent to '.$user['email']);
        }
    }
    $db->close();
    //WAIT FOR THE UI TO FINALIZE THE PROCESS
    //sleep(7);
    //REMOVE ALL TEMPORARY FILES
    shell_exec('sudo rm -rf ' . $attributes['folder']);
    //$log->info('Task #'.$tid.' end finalizing');
}
开发者ID:pardoc,项目名称:FAB-UI,代码行数:89,代码来源:finalize.php

示例4: initialize

 public function initialize($config = array())
 {
     // Use passed config first
     if (!empty($config)) {
         return parent::initialize($config);
     } else {
         // If nothing passed - try loading settings from config
         $emailConfig = $this->CI->config->item('plain_email_settings');
         if (!empty($emailConfig)) {
             return parent::initialize($emailConfig);
             // No settings in config - use defaults
         } else {
             return parent::initialize();
         }
     }
 }
开发者ID:iweave,项目名称:unmark,代码行数:16,代码来源:Plain_Email.php


注:本文中的CI_Email::initialize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。