本文整理汇总了PHP中CI_Email::subject方法的典型用法代码示例。如果您正苦于以下问题:PHP CI_Email::subject方法的具体用法?PHP CI_Email::subject怎么用?PHP CI_Email::subject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CI_Email
的用法示例。
在下文中一共展示了CI_Email::subject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: subject
public function subject($subject, $parse_data = NULL)
{
if (!empty($parse_data)) {
$subject = $this->parse_template($subject, $parse_data);
}
return parent::subject($subject);
}
示例2: chron_scheduler_send_message
function chron_scheduler_send_message($to, $from, $subject, $message)
{
$em = new \CI_Email();
$em->from($from);
$em->to($to);
$em->subject($subject);
$em->message($message);
return $em->send();
}
示例3: send_email
protected function send_email($to, $subject, $text)
{
$this->load->library('email');
$this->email->from(MAIL_FROM_ADDRESS, MAIL_FROM_NAME);
$this->email->bcc($to);
$this->email->bcc_batch_mode = true;
$this->email->subject($subject);
$this->email->message($text);
$this->email->batch_bcc_send();
return $this->email->send();
}
示例4: backup_email_log
function backup_email_log($to, $from, $subject)
{
$tmp = function_exists('sys_get_temp_dir') ? sys_get_temp_dir() : '/tmp';
$email_options = array('useragent' => 'freepbx', 'protocol' => 'mail');
$email = new CI_Email();
$msg[] = _('BACKUP LOG ATTACHED');
$email->from($from);
$email->to($to);
$email->subject(_('Backup Log:') . $subject);
$email->message(implode("\n", $msg));
$email->attach($tmp . '/backup.log');
$email->send();
unset($msg);
}
示例5: view
$to_address = 'hharrysidhu@gmail.com';
$from_address = 'tester@email.com';
// input field
$form_name = 'email name';
$subject = 'subject to test email';
// Pass some data into the email templates
$email_data = array();
$email_data['firstname'] = 'Look';
$email_data['lastname'] = 'look';
$email_data['email'] = 'tester@email.com';
define('MB_ENABLED', TRUE);
define('ICONV_ENABLED', TRUE);
$email_sender = new CI_Email($config);
$email_sender->from($from_address, $form_name);
$email_sender->to($to_address);
$email_sender->subject($subject);
$email_sender->message(view('email_template', $email_data));
//$email_sender->set_alt_message(view('email_template', $email_data));
if (!$email_sender->send()) {
exit('error' . 'User::create - Unable to send new user email. Response is as follows:' . $email_sender->print_debugger() . "\n\n");
} else {
echo 'email sent';
}
// Load view function
function view($path, $data)
{
ob_start();
extract($data);
include $path . '.php';
return ob_get_clean();
}
示例6: 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');
}
示例7: subject
public function subject($subject)
{
$subject = (string) $subject;
if ($this->mailer_engine == 'phpmailer') {
// Modified by Ivan Tcholakov, 01-AUG-2015.
// See https://github.com/ivantcholakov/codeigniter-phpmailer/issues/8
// This change probably is not needed, done anyway.
//$this->phpmailer->Subject = $subject;
$this->phpmailer->Subject = str_replace(array('{unwrap}', '{/unwrap}'), '', $subject);
//
} else {
parent::subject($subject);
}
return $this;
}
示例8: subject
public function subject($subject)
{
$subject = (string) $subject;
if ($this->mailer_engine == 'phpmailer') {
$this->phpmailer->Subject = (string) $subject;
} else {
parent::subject($subject);
}
return $this;
}
示例9: subject
/**
* Overrides the CI_Email subject function because it seems to set the
* subject in the _headers property array instead of the _subject property.
*
* @param string the email subject
* @return Postmark
*/
public function subject($subject)
{
parent::subject($subject);
$this->_subject = $subject;
return $this;
}
示例10: sendEmail
/**
* Send an email to a user
* @param int $id The user ID
* @param string $subject The email subject
* @param string $body The email body
*/
public function sendEmail($id, $subject, $body)
{
$user = $this->getUserByID($id);
if (empty($user) || empty($user['email'])) {
return false;
}
$email_options = array('useragent' => $this->brand, 'protocol' => 'mail');
$email = new \CI_Email();
//TODO: Stop gap until sysadmin becomes a full class
if (!function_exists('sysadmin_get_storage_email') && $this->FreePBX->Modules->checkStatus('sysadmin') && file_exists($this->FreePBX->Config()->get('AMPWEBROOT') . '/admin/modules/sysadmin/functions.inc.php')) {
include $this->FreePBX->Config()->get('AMPWEBROOT') . '/admin/modules/sysadmin/functions.inc.php';
}
$femail = $this->FreePBX->Config()->get('AMPUSERMANEMAILFROM');
if (function_exists('sysadmin_get_storage_email')) {
$emails = sysadmin_get_storage_email();
if (!empty($emails['fromemail']) && filter_var($emails['fromemail'], FILTER_VALIDATE_EMAIL)) {
$femail = $emails['fromemail'];
}
}
$from = !empty($femail) ? $femail : get_current_user() . '@' . gethostname();
$email->from($from);
$email->to($user['email']);
$email->subject($subject);
$email->message($body);
$email->send();
}
示例11: subject
function subject($subject)
{
$this->_plaintext_subject = $subject;
parent::subject($subject);
}
示例12: forwardMessageByExtension
/**
* Forward a voicemail message to a new folder
* @param string $msg The message ID
* @param int $ext The voicemail extension message is coming from
* @param int $rcpt The recipient, voicemail will wind up in the INBOX
*/
public function forwardMessageByExtension($msg, $ext, $to)
{
$fromVM = $this->getVoicemailBoxByExtension($ext);
$messages = $this->getMessagesByExtension($ext);
if (isset($messages['messages'][$msg])) {
$info = $messages['messages'][$msg];
$txt = $info['path'] . "/" . $info['fid'] . ".txt";
if (file_exists($txt) && is_readable($txt)) {
$toVM = $this->getVoicemailBoxByExtension($to);
$context = $toVM['vmcontext'];
$toFolder = $this->vmPath . '/' . $context . '/' . $to . '/INBOX';
if (file_exists($toFolder) && is_writable($toFolder)) {
$files = array();
$files[] = $txt;
$movedFiles = array();
foreach ($info['format'] as $format) {
if (file_exists($format['path'] . "/" . $format['filename'])) {
$files[] = $format['path'] . "/" . $format['filename'];
}
}
//if the folder is empty (meaning we dont have a 0000 file) then set this to 0000
$tname = preg_replace('/([0-9]+)/', '0000', basename($txt));
$vminfotxt = '';
if (!file_exists($toFolder . "/" . $tname)) {
foreach ($files as $file) {
$fname = preg_replace('/msg([0-9]+)/', 'msg0000', basename($file));
copy($file, $toFolder . "/" . $fname);
$movedFiles[] = $toFolder . "/" . $fname;
}
} else {
//Else we have other voicemail data in here so do something else
//figure out the last file in the directory
$oldFiles = glob($toFolder . "/*.txt");
$numbers = array();
foreach ($oldFiles as $file) {
$file = basename($file);
preg_match('/([0-9]+)/', $file, $matches);
$numbers[] = $matches[1];
}
rsort($numbers);
$next = sprintf('%04d', $numbers[0] + 1);
foreach ($files as $file) {
$fname = preg_replace('/msg([0-9]+)/', "msg" . $next, basename($file));
copy($file, $toFolder . "/" . $fname);
$movedFiles[] = $toFolder . "/" . $fname;
}
}
//send email from/to new mailbox
$vm = $this->FreePBX->LoadConfig->getConfig("voicemail.conf");
$emailInfo = array("normal" => array("body" => !empty($vm['general']['emailbody']) ? $vm['general']['emailbody'] : 'Dear ${VM_NAME}:\\n\\n\\tjust wanted to let you know you were just left a ${VM_DUR} long message (number ${VM_MSGNUM})\\nin mailbox ${VM_MAILBOX} from ${VM_CALLERID}, on ${VM_DATE}, so you might\\nwant to check it when you get a chance. Thanks!\\n\\n\\t\\t\\t\\t--Asterisk\\n', "subject" => !empty($vm['general']['emailsubject']) ? $vm['general']['emailsubject'] : (isset($vm['general']['pbxskip']) && $vm['general']['pbxskip'] == "no" ? "[PBX]: " : "") . 'New message ${VM_MSGNUM} in mailbox ${VM_MAILBOX}', "fromstring" => !empty($vm['general']['fromstring']) ? $vm['general']['fromstring'] : 'The Asterisk PBX'), "pager" => array("body" => !empty($vm['general']['pagerbody']) ? $vm['general']['pagerbody'] : 'New ${VM_DUR} long msg in box ${VM_MAILBOX}\\nfrom ${VM_CALLERID}, on ${VM_DATE}', "subject" => !empty($vm['general']['pagersubject']) ? $vm['general']['pagersubject'] : 'New VM', "fromstring" => !empty($vm['general']['pagerfromstring']) ? $vm['general']['pagerfromstring'] : 'The Asterisk PBX'));
$processUser = posix_getpwuid(posix_geteuid());
$from = !empty($vm['general']['serveremail']) ? $vm['general']['serveremail'] : $processUser['name'] . '@' . gethostname();
foreach ($emailInfo as &$einfo) {
$einfo['body'] = str_replace(array('\\n', '\\t'), array("\n", "\t"), $einfo['body']);
$einfo['body'] = str_replace(array('${VM_NAME}', '${VM_MAILBOX}', '${VM_CALLERID}', '${VM_DUR}', '${VM_DATE}', '${VM_MSGNUM}'), array($toVM['name'], $to, $info['callerid'], $info['duration'], $info['origdate'], $info['msg_id']), $einfo['body']);
$einfo['subject'] = str_replace(array('${VM_NAME}', '${VM_MAILBOX}', '${VM_CALLERID}', '${VM_DUR}', '${VM_DATE}', '${VM_MSGNUM}'), array($toVM['name'], $to, $info['callerid'], $info['duration'], $info['origdate'], $info['msg_id']), $einfo['subject']);
}
if (!empty($toVM['email'])) {
$em = new \CI_Email();
if ($toVM['options']['attach'] == "yes") {
$em->attach($info['path'] . "/" . $info['file']);
}
$em->from($from, $emailInfo['normal']['fromstring']);
$em->to($toVM['email']);
$em->subject($emailInfo['normal']['subject']);
$em->message($emailInfo['normal']['body']);
$em->send();
}
if (!empty($toVM['pager'])) {
$em = new \CI_Email();
$em->from($from, $emailInfo['pager']['fromstring']);
$em->to($toVM['email']);
$em->subject($emailInfo['pager']['subject']);
$em->message($emailInfo['pager']['body']);
$em->send();
}
if (isset($toVM['delete']) && $toVM['delete'] == "yes") {
//now delete the voicemail wtf.
foreach ($movedFiles as $file) {
unlink($file);
}
}
//Just for sanity sakes recheck the directories hopefully this doesnt take hours though.
$this->renumberAllMessages($toFolder);
}
}
}
if (!empty($fromVM['context'])) {
$this->astman->VoicemailRefresh($fromVM['context'], $ext);
}
if (!empty($toVM['context'])) {
$this->astman->VoicemailRefresh($toVM['context'], $to);
}
}
示例13: foreach
function store_backup()
{
foreach ($this->b['storage_servers'] as $s) {
$s = $this->s[$s];
switch ($s['type']) {
case 'local':
$path = backup__($s['path']) . '/' . $this->b['_dirname'];
//ensure directory structure
if (!is_dir($path)) {
mkdir($path, 0755, true);
}
//would rather use the native copy() here, but by defualt
//php doesnt support files > 2GB
//see here for a posible solution:
//http://ca3.php.net/manual/en/function.fopen.php#37791
$cmd[] = fpbx_which('cp');
$cmd[] = $this->b['_tmpfile'];
$cmd[] = $path . '/' . $this->b['_file'] . '.tgz';
exec(implode(' ', $cmd), $error, $status);
unset($cmd, $error);
if ($status !== 0) {
$this->b['error'] = 'Error copying ' . $this->b['_tmpfile'] . ' to ' . $path . '/' . $this->b['_file'] . '.tgz: ' . $error;
backup_log($this->b['error']);
}
//run maintenance on the directory
$this->maintenance($s['type'], $s);
break;
case 'email':
//TODO: set agent to something informative, including fpbx & backup versions
$email_options = array('useragent' => 'freepbx', 'protocol' => 'mail');
$email = new \CI_Email();
//Generic email
$from = 'freepbx@freepbx.local';
//If we have sysadmin and "from is set"
if (function_exists('sysadmin_get_storage_email')) {
$emails = sysadmin_get_storage_email();
//Check that what we got back above is a email address
if (!empty($emails['fromemail']) && filter_var($emails['fromemail'], FILTER_VALIDATE_EMAIL)) {
$from = $emails['fromemail'];
}
}
//If the user set an email in advanced settings it wins, otherwise take whatever won above.
$from = filter_var($this->amp_conf['AMPBACKUPEMAILFROM'], FILTER_VALIDATE_EMAIL) ? $this->amp_conf['AMPBACKUPEMAILFROM'] : $from;
$msg[] = _('Name') . ': ' . $this->b['name'];
$msg[] = _('Created') . ': ' . date('r', $this->b['_ctime']);
$msg[] = _('Files') . ': ' . $this->manifest['file_count'];
$msg[] = _('Mysql Db\'s') . ': ' . $this->manifest['mysql_count'];
$msg[] = _('astDb\'s') . ': ' . $this->manifest['astdb_count'];
$email->from($from);
$email->to(backup__($s['addr']));
$email->subject($this->amp_conf['FREEPBX_SYSTEM_IDENT'] . ' ' . _('Backup') . ' ' . $this->b['name']);
$body = implode("\n", $msg);
// If the backup file is more than 25MB, yell
$encodedsize = ceil(filesize($this->b['_tmpfile']) / 3) * 4;
if ($encodedsize > 26214400) {
$email->subject($this->amp_conf['FREEPBX_SYSTEM_IDENT'] . ' ' . _('Backup ERROR (exceeded SMTP limits)') . ' ' . $this->b['name']);
$email->message(_('BACKUP NOT ATTACHED') . "\n" . _('The backup file exceeded the maximum SMTP limits of 25MB. It was not attempted to be sent. Please shrink your backup, or use a different method of transferring your backup.') . "\n{$body}\n");
} elseif ($encodedsize > $s['maxsize']) {
$email->subject($this->amp_conf['FREEPBX_SYSTEM_IDENT'] . ' ' . _('Backup ERROR (exceeded soft limit)') . ' ' . $this->b['name']);
$email->message(_('BACKUP NOT ATTACHED') . "\n" . _('The backup file exceeded the soft limit set in SMTP configuration (%s bytes). It was not attempted to be sent. Please shrink your backup, or use a different method of transferring your backup.') . "\n{$body}\n");
} else {
$email->message($body);
$email->attach($this->b['_tmpfile']);
}
$email->send();
unset($msg);
break;
case 'ftp':
//subsitute variables if nesesary
$s['host'] = backup__($s['host']);
$s['port'] = backup__($s['port']);
$s['user'] = backup__($s['user']);
$s['password'] = backup__($s['password']);
$s['path'] = trim(backup__($s['path']), '/');
$fstype = isset($s['fstype']) ? $s['fstype'] : 'auto';
$path = $s['path'] . '/' . $this->b['_dirname'];
$connection = new Connection($s['host'], $s['user'], $s['password'], $s['port'], 90, $s['transfer'] == 'passive');
try {
$connection->open();
} catch (\Exception $e) {
$this->b['error'] = $e->getMessage();
backup_log($this->b['error']);
return;
}
$wrapper = new FTPWrapper($connection);
$permFactory = new PermissionsFactory();
switch ($fstype) {
case 'auto':
$ftptype = $wrapper->systype();
if (strtolower($ftptype) == "unix") {
$fsFactory = new FilesystemFactory($permFactory);
} else {
$fsFactory = new WindowsFilesystemFactory();
}
break;
case 'unix':
$fsFactory = new FilesystemFactory($permFactory);
break;
case 'windows':
$fsFactory = new WindowsFilesystemFactory();
//.........这里部分代码省略.........
示例14: trim
if (!empty($user)) {
$name = !empty($user['displayname']) ? $user['displayname'] : trim($user['fname'] . " " . $user['lname']);
$name = !empty($name) ? $name : $user['username'];
} else {
$name = $var['exten'];
}
$msg .= _('For User') . ': ' . $name . "\n";
}
}
$tif = $var['file'];
if (!empty($var['to'])) {
//build email
$email = new CI_Email();
$email->from($var['from']);
$email->to($var['to']);
$email->subject($var['subject']);
$email->message($msg);
switch ($var['attachformat']) {
case 'both':
$pdf = fax_file_convert('tif2pdf', $var['file'], '', true);
$email->attach($pdf);
$email->attach($tif);
break;
case 'tif':
$email->attach($tif);
break;
case 'pdf':
$pdf = fax_file_convert('tif2pdf', $var['file'], '', true);
$email->attach($pdf);
break;
}
示例15: subject
public function subject($subject)
{
$subject = (string) $subject;
if ($this->mailer_engine == 'phpmailer') {
$this->phpmailer->Subject = str_replace(array('{unwrap}', '{/unwrap}'), '', $subject);
} else {
parent::subject($subject);
}
return $this;
}