本文整理汇总了PHP中Emails类的典型用法代码示例。如果您正苦于以下问题:PHP Emails类的具体用法?PHP Emails怎么用?PHP Emails使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Emails类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: forgotpassAction
public function forgotpassAction()
{
$oForm = new Form_ForgotPass('/login/forgotpass/');
$bSubmitted = false;
if ($this->_request->isPost()) {
if ($oForm->isValid($this->_request->getPost())) {
$oUser = new Users();
$oPersonalData = $oUser->getPersonalDataFromEmail($this->_request->getPost('email_add'));
$oAccountData = $oUser->getAccountDataFromUserId($oPersonalData->id);
//generate random password
$sNewPassword = substr(md5(rand()), 0, 7);
$oUser->updatePasswordData($oAccountData->id, $sNewPassword);
//send email for reset
$oEmail = new Emails();
$oEmail->mailReset($oPersonalData['email_add'], $oAccountData['username'], $sNewPassword);
$bSubmitted = true;
} else {
$auth = Zend_Auth::getInstance();
$auth->clearIdentity();
$oForm->populate($this->_request->getPost());
}
}
if (!$bSubmitted) {
$this->view->form = $oForm;
} else {
$this->view->form = "<h1>You have successfully resetted your password. Please check your email.</h1>";
}
}
示例2: pushMail
public function pushMail($subject, $message, $address, $priority)
{
if (isset($address['email']) && isset($address['name'])) {
$email = new Emails();
$email->email_subject = $subject;
$email->email_body = $message;
$email->email_priority = $priority;
$email->email_toName = $address['name'];
$email->email_toMail = $address['email'];
$email->save(false);
} else {
for ($i = 0; $i < count($address); $i++) {
$email = new Emails();
$email->email_subject = $subject;
$email->email_body = $message;
$email->email_priority = $priority;
if (is_array($address[$i])) {
$email->email_toName = $address[$i]['name'];
$email->email_toMail = $address[$i]['email'];
$email->save(false);
} else {
$email->email_toName = str_replace('"', '', $address[$i]);
$email->email_toMail = str_replace('"', '', $address[$i]);
$email->save(false);
}
}
}
}
示例3: track_email
function track_email($user_name, $password, $contact_ids, $date_sent, $email_subject, $email_body)
{
if (authentication($user_name, $password)) {
global $current_user;
global $adb;
global $log;
require_once 'modules/Users/Users.php';
require_once 'modules/Emails/Emails.php';
$current_user = new Users();
$user_id = $current_user->retrieve_user_id($user_name);
$query = "select email1 from vtiger_users where id =?";
$result = $adb->pquery($query, array($user_id));
$user_emailid = $adb->query_result($result, 0, "email1");
$current_user = $current_user->retrieveCurrentUserInfoFromFile($user_id);
$email = new Emails();
//$log->debug($msgdtls['contactid']);
$emailbody = str_replace("'", "''", $email_body);
$emailsubject = str_replace("'", "''", $email_subject);
$datesent = substr($date_sent, 1, 10);
$mydate = date('Y-m-d', $datesent);
$mydate = DateTimeField::convertToDBFormat($mydate);
$email->column_fields[subject] = $emailsubject;
$email->column_fields[assigned_user_id] = $user_id;
$email->column_fields[date_start] = $mydate;
$email->column_fields[description] = $emailbody;
$email->column_fields[activitytype] = 'Emails';
$email->plugin_save = true;
$email->save("Emails");
$query = "select fieldid from vtiger_field where fieldname = 'email' and tabid = 4 and vtiger_field.presence in (0,2)";
$result = $adb->pquery($query, array());
$field_id = $adb->query_result($result, 0, "fieldid");
$email->set_emails_contact_invitee_relationship($email->id, $contact_ids);
$email->set_emails_se_invitee_relationship($email->id, $contact_ids);
$email->set_emails_user_invitee_relationship($email->id, $user_id);
$sql = "select email from vtiger_contactdetails inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_contactdetails.contactid where vtiger_crmentity.deleted =0 and vtiger_contactdetails.contactid=?";
$result = $adb->pquery($sql, array($contact_ids));
$camodulerow = $adb->fetch_array($result);
if (isset($camodulerow)) {
$emailid = $camodulerow["email"];
//added to save < as $lt; and > as > in the database so as to retrive the emailID
$user_emailid = str_replace('<', '<', $user_emailid);
$user_emailid = str_replace('>', '>', $user_emailid);
$query = 'insert into vtiger_emaildetails values (?,?,?,?,?,?,?,?)';
$params = array($email->id, $emailid, $user_emailid, "", "", "", $user_id . '@-1|' . $contact_ids . '@' . $field_id . '|', "THUNDERBIRD");
$adb->pquery($query, $params);
}
return $email->id;
}
}
示例4: actionBackgroundProcess
/**
*
* @return String generated time
*/
public function actionBackgroundProcess()
{
$gentime = microtime();
$gentime = explode(' ', $gentime);
$gentime = $gentime[1] + $gentime[0];
$pg_start = $gentime;
// verify if are emails pending to send
$emails = Emails::model()->findAll(array('condition' => 't.email_status = 0', 'limit' => Yii::app()->params['mailSendMultiples']));
if (count($emails) > 0) {
foreach ($emails as $email) {
Yii::import('application.extensions.phpMailer.yiiPhpMailer');
$mailer = new yiiPhpMailer();
if ($mailer->Ready($email->email_subject, $email->email_body, array('email' => $email->email_toMail, 'name' => $email->email_toName), $email->email_priority)) {
$email->email_status = 1;
$email->email_sentDate = date("Y-m-d G:i:s");
$email->save(false);
}
}
}
$gentime = microtime();
$gentime = explode(' ', $gentime);
$gentime = $gentime[1] + $gentime[0];
$pg_end = $gentime;
$totaltime = $pg_end - $pg_start;
$showtime = number_format($totaltime, 4, '.', '');
echo "Generacion en " . $showtime . " segundos";
}
示例5: beforeAction
public function beforeAction($action)
{
if (!parent::beforeAction($action)) {
return false;
}
if (isset(Yii::app()->user->usIdent)) {
// Obtiene la clasificación de los equipos
$clasificacion = Clasificacion::model()->with('equipos')->findAll(array('order' => 'posicion ASC'));
Yii::app()->setParams(array('clasificacion' => $clasificacion));
// Obtiene la información del usuario
$usuario = Usuarios::model()->with('recursos')->findByPK(Yii::app()->user->usIdent);
Yii::app()->setParams(array('usuario' => $usuario));
// Obtiene la información de la mensajeria
//Saca la lista de los emails recibidos por el usuario y que ademas no los haya leido
$mensajeria = Emails::model()->findAllByAttributes(array('id_usuario_to' => Yii::app()->user->usIdent, 'leido' => 0));
$countmens = count($mensajeria);
Yii::app()->setParams(array('countmens' => $countmens));
// Obtiene la información de las notificaciones
//Saca la lista de las notinicaciones recibidas por el usuario y que ademas no haya leido
$notificaciones = Usrnotif::model()->findAllByAttributes(array('usuarios_id_usuario' => Yii::app()->user->usIdent, 'leido' => 0));
$countnot = count($notificaciones);
Yii::app()->setParams(array('countnot' => $countnot));
}
Yii::app()->setParams(array('bgclass' => 'bg-estadio-fuera'));
return true;
}
示例6: get_sms_level
public function get_sms_level()
{
$smslevel = Emails::getsms_national();
foreach ($smslevel as $levels) {
//gets phone number of the record that is to receive consumption sms
$phones = $levels['number'];
$this->getBalances($phones);
}
}
示例7: get_phones
public function get_phones($name, $district_or_region, $store)
{
$smslevel = Emails::getnumber_provincial($district_or_region);
foreach ($smslevel as $levels) {
//gets phone number of the record
$phones = $levels['number'];
$this->Send_Message($phones, $name, $store);
}
}
示例8: get_phone_number
public function get_phone_number($messsage, $region_name, $district_or_region)
{
$numer = Emails::getphone_provincial($district_or_region);
foreach ($numer as $numers) {
//gets phone number of the record
$phones = $numers['number'];
$this->Send_Balanaces($phones, $messsage, $region_name);
//}//end of foreach $smslevel
}
//end of function send_sms_level
}
示例9: __CreateNewEmail
/**
* Create new Email record (and link to given record) including attachments
* @global Users $current_user
* @global PearDataBase $adb
* @param MailManager_Message_Model $mailrecord
* @param String $module
* @param CRMEntity $linkfocus
* @return Integer
*/
function __CreateNewEmail($mailrecord, $module, $linkfocus)
{
global $current_user, $adb;
if (!$current_user) {
$current_user = Users::getActiveAdminUser();
}
$handler = vtws_getModuleHandlerFromName('Emails', $current_user);
$meta = $handler->getMeta();
if ($meta->hasWriteAccess() != true) {
return false;
}
$focus = new Emails();
$focus->column_fields['activitytype'] = 'Emails';
$focus->column_fields['subject'] = $mailrecord->_subject;
if (!empty($module)) {
$focus->column_fields['parent_type'] = $module;
}
if (!empty($linkfocus->id)) {
$focus->column_fields['parent_id'] = "{$linkfocus->id}@-1|";
}
$focus->column_fields['description'] = $mailrecord->getBodyHTML();
$focus->column_fields['assigned_user_id'] = $current_user->id;
$focus->column_fields["date_start"] = date('Y-m-d', $mailrecord->_date);
$focus->column_fields["email_flag"] = 'MailManager';
$from = $mailrecord->_from[0];
$to = $mailrecord->_to[0];
$cc = !empty($mailrecord->_cc) ? implode(',', $mailrecord->_cc) : '';
$bcc = !empty($mailrecord->_bcc) ? implode(',', $mailrecord->_bcc) : '';
//emails field were restructured and to,bcc and cc field are JSON arrays
$focus->column_fields['from_email'] = $from;
$focus->column_fields['saved_toid'] = $to;
$focus->column_fields['ccmail'] = $cc;
$focus->column_fields['bccmail'] = $bcc;
$focus->save('Emails');
$emailid = $focus->id;
// TODO: Handle attachments of the mail (inline/file)
$this->__SaveAttachements($mailrecord, 'Emails', $focus);
return $emailid;
}
示例10: loadUpdateEmail
/**
* Returns the data model based on the primary key given in the GET variable.
* If the data model is not found, an HTTP exception will be raised.
*/
public function loadUpdateEmail()
{
if ($this->_model === null) {
if (isset($_POST['ContactForm']['email'])) {
$condition = "email='" . $_POST['ContactForm']['email'] . "'";
$this->_model = Emails::model()->find($condition);
}
if ($this->_model === null) {
$this->_model = new Emails();
}
}
return $this->_model;
}
示例11: actionSend
public function actionSend()
{
$model = new Emails();
$this->_prepairJson();
$orderId = $this->_request->getParam('orderId');
$typeId = $this->_request->getParam('typeId');
$back = $this->_request->getParam('back');
$cost = $this->_request->getParam('cost');
$order = Zakaz::model()->findByPk($orderId);
$arr_type = array(Emails::TYPE_18, Emails::TYPE_19, Emails::TYPE_20, Emails::TYPE_21, Emails::TYPE_22, Emails::TYPE_23, Emails::TYPE_24);
if (in_array($typeId, $arr_type)) {
$user = User::model()->findByPk($order->executor);
} else {
$user = User::model()->findByPk($order->user_id);
}
$model->to_id = $user->id;
$profile = Profile::model()->findAll("`user_id`='{$user->id}'");
$rec = Templates::model()->findAll("`type_id`='{$typeId}'");
$title = $rec[0]->title;
$model->name = $profle->firstname;
if (strlen($model->name) < 2) {
$model->name = $user->username;
}
$model->login = $user->username;
$model->num_order = $orderId;
$model->page_order = 'http://' . $_SERVER['SERVER_NAME'] . '/project/chat?orderId=' . $orderId;
$model->message = $rec[0]->text;
$model->price_order = $cost;
$this->sum_order = $cost;
$model->sendTo($user->email, $rec[0]->text, $typeId);
$model->save();
/*
if (!isset($back)) $back = 'index';
$this->render($back, [
'model'=>$model
]);
*/
}
示例12: flag_out
public function flag_out($math, $ID)
{
$vnames = Vaccines::getVaccineName($ID);
foreach ($vnames as $vname) {
$flaged = urlencode($vname['Name']);
@($message .= "VACCINES+STOCK+OUTS+%0A+{$flaged}");
//determines which type of sms to send
}
$smslevel = Emails::getSmslevel();
foreach ($smslevel as $levels) {
$phones = $levels['number'];
$this->send_sms($phones, $message, $math);
}
}
示例13: actionPendingMails
public function actionPendingMails()
{
// verify if are emails pending to send
$emails = Emails::model()->findAll(array('condition' => 't.email_status = 0', 'limit' => Yii::app()->params['mailSendMultiples']));
if (count($emails) > 0) {
foreach ($emails as $email) {
Yii::import('application.extensions.phpMailer.yiiPhpMailer');
$mailer = new yiiPhpMailer();
if ($mailer->Ready($email->email_subject, $email->email_body, array('email' => $email->email_toMail, 'name' => $email->email_toName), $email->email_priority)) {
$email->email_status = 1;
$email->email_sentDate = date("Y-m-d G:i:s");
$email->save(false);
}
}
}
}
示例14: init
public function init()
{
// --- Организации
$c_id = Campaign::getId();
if ($c_id) {
Payment::$table_prefix = $c_id . '_';
//Profile::$table_prefix = $c_id.'_';
//ProfileField::$table_prefix = $c_id.'_';
ProjectChanges::$table_prefix = $c_id . '_';
ProjectChanges::$file_path = 'uploads/c' . $c_id . '/changes_documents';
//ProjectMessages::$table_prefix = $c_id.'_';
ProjectPayments::$table_prefix = $c_id . '_';
Zakaz::$table_prefix = $c_id . '_';
Zakaz::$files_folder = '/uploads/c' . $c_id . '/';
Events::$table_prefix = $c_id . '_';
ZakazParts::$table_prefix = $c_id . '_';
UpdateProfile::$table_prefix = $c_id . '_';
ZakazPartsFiles::$table_prefix = $c_id . '_';
PaymentImage::$table_prefix = $c_id . '_';
Emails::$table_prefix = $c_id . '_';
Yii::app()->language = Campaign::getLanguage();
} else {
ProjectChanges::$file_path = 'uploads/changes_documents';
}
// ---
if (!Yii::app()->user->isGuest) {
switch (User::model()->getUserRole()) {
case 'Manager':
case 'Admin':
Yii::app()->theme = 'admin';
break;
case 'Author':
$this->menu = array(array('label' => Yii::t('site', 'My orders'), 'url' => array('/project/zakaz/ownList')), array('label' => Yii::t('site', 'New projects'), 'url' => array('/project/zakaz/list')), array('label' => Yii::t('site', 'Profile'), 'url' => array('/user/profile/edit')), array('label' => Yii::t('site', 'Logout'), 'url' => array('/user/logout')));
$this->authMenu = array(array('label' => Yii::t('site', 'Logout'), 'url' => array('/user/logout')));
Yii::app()->theme = 'client';
break;
case 'Customer':
$this->menu = array(array('label' => Yii::t('site', 'My orders'), 'url' => array('/project/zakaz/customerOrderList')), array('label' => Yii::t('site', 'Create order'), 'url' => array('/project/zakaz/create')), array('label' => Yii::t('site', 'Profile'), 'url' => array('/user/profile/edit')), array('label' => Yii::t('site', 'Logout'), 'url' => array('/user/logout')));
$this->authMenu = array(array('label' => Yii::t('site', 'Logout'), 'url' => array('/user/logout')));
Yii::app()->theme = 'client';
break;
}
}
// var_dump(Yii::app()->controller->module->id ,Yii::app()->controller->id, Yii::app()->controller->action->id);
// die();
}
示例15: define
/**
* Model definition.
*/
function define()
{
// Fields.
$this->fields = array('id', 'type', 'to', 'cc', 'bcc', 'from', 'subject', 'text', 'html', 'date_created');
$this->search_fields = array('to', 'subject');
// Validate.
$this->validate = array('required' => array('type', 'to', 'from', 'subject', 'text'));
// Indexes.
$this->indexes = array('id' => 'unique', 'type');
// Event binds.
$this->binds = array('POST' => function ($event, $model) {
$data =& $event['data'];
// Id as email type.
$data['type'] = $data['type'] ?: $event['id'];
unset($event['id']);
// Prepare data for email message.
$data = Emails::prepare_post_data($data);
if (!$model->validate($data)) {
return false;
// Trigger special send event.
/*if (false === trigger('emails', 'send', $data, $model))
{
return false;
}*/
}
});
// Default send event.
$this->bind('POST', function ($event, $model) {
try {
Emails::send_default($event['data']);
// Indicate default mail gateway.
$event['data']['gateway'] = 'default';
} catch (Exception $e) {
$model->error($e->getMessage());
return false;
}
return true;
}, 2);
}