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


PHP Email::sendEmail方法代码示例

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


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

示例1: processAction

 /**
  * Process the page when its submitted
  *
  * @author kuma, salvipascual
  * @version 1.0
  * */
 public function processAction()
 {
     // get the values from the post
     $captcha = trim($this->request->getPost('captcha'));
     $name = trim($this->request->getPost('name'));
     $inviter = trim($this->request->getPost('email'));
     $guest = trim($this->request->getPost('guest'));
     if (!isset($_SESSION['phrase'])) {
         $_SESSION['phrase'] = uniqid();
     }
     // throw a die()
     // check all values passed are valid
     if (strtoupper($captcha) != strtoupper($_SESSION['phrase']) || $name == "" || !filter_var($inviter, FILTER_VALIDATE_EMAIL) || !filter_var($guest, FILTER_VALIDATE_EMAIL)) {
         die("Error procesando, por favor valla atras y comience nuevamente.");
     }
     // params for the response
     $this->view->name = $name;
     $this->view->email = $inviter;
     // create classes needed
     $connection = new Connection();
     $email = new Email();
     $utils = new Utils();
     $render = new Render();
     // do not invite people who are already using Apretaste
     if ($utils->personExist($guest)) {
         $this->view->already = true;
         return $this->dispatcher->forward(array("controller" => "invitar", "action" => "index"));
     }
     // send notification to the inviter
     $response = new Response();
     $response->setResponseSubject("Gracias por darle internet a un Cubano");
     $response->setEmailLayout("email_simple.tpl");
     $response->createFromTemplate("invitationThankYou.tpl", array('num_notifications' => 0));
     $response->internal = true;
     $html = $render->renderHTML(new Service(), $response);
     $email->sendEmail($inviter, $response->subject, $html);
     // send invitations to the guest
     $response = new Response();
     $response->setResponseSubject("{$name} le ha invitado a revisar internet desde su email");
     $responseContent = array("host" => $name, "guest" => $guest, 'num_notifications' => 0);
     $response->createFromTemplate("invitation.tpl", $responseContent);
     $response->internal = true;
     $html = $render->renderHTML(new Service(), $response);
     $email->sendEmail($guest, $response->subject, $html);
     // save all the invitations into the database at the same time
     $connection->deepQuery("INSERT INTO invitations (email_inviter,email_invited,source) VALUES ('{$inviter}','{$guest}','abroad')");
     // redirect to the invite page
     $this->view->message = true;
     return $this->dispatcher->forward(array("controller" => "invitar", "action" => "index"));
 }
开发者ID:Apretaste,项目名称:Core,代码行数:56,代码来源:InvitarController.php

示例2: forgotPassword

 public function forgotPassword($data)
 {
     $saveData = array();
     $email = $data['email'];
     $respone = array();
     $options = array('conditions' => array('User.email' => $email));
     $user = $this->find("first", $options);
     if ($user) {
         $resetCode = Security::hash(String::uuid(), 'sha1', true);
         $url = Router::url(array('controller' => 'users', 'action' => 'resetPassword'), true) . '?code=' . $resetCode;
         //Removing any previously generated
         $this->ResetPassword->deleteAll(array('ResetPassword.user_id' => $user['User']['id']), false);
         //saving validation code
         $saveData['ResetPassword'] = array('user_id' => $user['User']['id'], 'reset_code' => $resetCode);
         $status = $this->ResetPassword->saveAll($saveData, array('validate' => false));
         if ($status) {
             $Email = new Email();
             $message = 'Reset password';
             $message .= "Copy and Paste following url in your browser:\n";
             $message .= $url;
             if (SEND_EMAIL) {
                 $emailStatus = $Email->sendEmail($email, $message, EMAIL_TPL_RESET_PASSWORD);
             } else {
                 $emailStatus = true;
             }
             if ($emailStatus) {
                 return array('status' => true, 'success_msg' => USER_RESET_PASSWORD_SUCCESS);
             }
         } else {
             return array('status' => false, 'errors' => USER_ERR_RESET_PASSWORD_FAILED);
         }
     } else {
         return array('status' => false, 'errors' => USER_ERR_EMAIL_NOT_REGISTERED);
     }
 }
开发者ID:AshSingh4888,项目名称:olx_fb,代码行数:35,代码来源:User.php

示例3: newUserLDAP

 /**
  * Crear un nuevo usuario en la BBDD con los datos de LDAP.
  * Esta función crea los usuarios de LDAP en la BBDD para almacenar infomación del mismo
  * y utilizarlo en caso de fallo de LDAP
  *
  * @param User $User
  * @return bool
  */
 public static function newUserLDAP(User $User)
 {
     $passdata = UserPass::makeUserPassHash($User->getUserPass());
     $groupId = Config::getValue('ldap_defaultgroup', 0);
     $profileId = Config::getValue('ldap_defaultprofile', 0);
     $query = 'INSERT INTO usrData SET ' . 'user_name = :name,' . 'user_groupId = :groupId,' . 'user_login = :login,' . 'user_pass = :pass,' . 'user_hashSalt = :hashSalt,' . 'user_email = :email,' . 'user_notes = :notes,' . 'user_profileId = :profileId,' . 'user_isLdap = 1,' . 'user_isDisabled = :isDisabled';
     $data['name'] = $User->getUserName();
     $data['login'] = $User->getUserLogin();
     $data['pass'] = $passdata['pass'];
     $data['hashSalt'] = $passdata['salt'];
     $data['email'] = $User->getUserEmail();
     $data['notes'] = _('Usuario de LDAP');
     $data['groupId'] = $groupId;
     $data['profileId'] = $profileId;
     $data['isDisabled'] = $groupId === 0 || $profileId === 0 ? 1 : 0;
     if (DB::getQuery($query, __FUNCTION__, $data) === false) {
         return false;
     }
     if (!$groupId || !$profileId) {
         $Log = new Log(_('Activación Cuenta'));
         $Log->addDescription(_('Su cuenta está pendiente de activación.'));
         $Log->addDescription(_('En breve recibirá un email de confirmación.'));
         $Log->writeLog();
         Email::sendEmail($Log, $User->getUserEmail(), false);
     }
     Log::writeNewLogAndEmail(_('Nuevo usuario de LDAP'), sprintf("%s (%s)", $User->getUserName(), $User->getUserLogin()));
     return true;
 }
开发者ID:bitking,项目名称:sysPass,代码行数:36,代码来源:UserLdap.class.php

示例4: ActionAddAccount

 /**
  * 增加系统账户页面
  */
 public function ActionAddAccount()
 {
     $account_model = new Account();
     if (isset($_POST['Account'])) {
         // 密码要md5加密
         if (isset($_POST['Account']['PassWord']) && !empty($_POST['Account']['PassWord']) && isset($_POST['Account']['PassWord2']) && !empty($_POST['Account']['PassWord2'])) {
             $password = $_POST['Account']['PassWord'];
             $_POST['Account']['PassWord'] = md5($password);
             $_POST['Account']['PassWord2'] = md5($_POST['Account']['PassWord2']);
         }
         $account_model->attributes = $_POST['Account'];
         // 执行添加
         if ($account_model->save()) {
             // 添加操作日志 [S]
             $log = Yii::app()->user->name . '于 ' . date('Y-m-d H:i:s', time()) . ' 添加了一个名为 【' . $_POST['Account']['UserName'] . '】 的账户';
             OperationLogManage::AddOperationLog($log);
             // 添加日志
             // 添加操作日志 [E]
             // 发送通知邮件
             $email_content = '用户名:' . $_POST['Account']['UserName'] . '<br />密 码:' . $password;
             Email::sendEmail($_POST['Account']['Email'], '百城资源后台管理系统账户已开通', $email_content, 'smtp.baicheng.com', CARRENTALAPI_SENDEMAIL_USERNAME, CARRENTALAPI_SENDEMAIL_PASSWORD);
             Yii::app()->user->setFlash('save_sign', '添加成功');
             $this->redirect(Yii::app()->createUrl('Account/RestrictAccount', array('account_id' => $account_model->attributes['ID'])));
         } else {
             Yii::app()->user->setFlash('save_sign', '添加失败');
             $this->renderPartial('add_account', array('account_model' => $account_model));
         }
     } else {
         $this->renderPartial('add_account', array('account_model' => $account_model));
     }
 }
开发者ID:lovecheng,项目名称:brs-demo2,代码行数:34,代码来源:AccountController.php

示例5: mainAction

 public function mainAction()
 {
     // inicialize supporting classes
     $connection = new Connection();
     $email = new Email();
     $service = new Service();
     $service->showAds = false;
     $render = new Render();
     $response = new Response();
     $utils = new Utils();
     $wwwroot = $this->di->get('path')['root'];
     // get valid people
     $people = $connection->deepQuery("\n\t\t\tSELECT email, username, first_name, last_access\n\t\t\tFROM person\n\t\t\tWHERE active=1\n\t\t\tAND email not in (SELECT DISTINCT email FROM delivery_dropped)\n\t\t\tAND DATE(last_access) > DATE('2016-05-01')\n\t\t\tAND email like '%.cu'\n\t\t\tAND email not like '%@mms.cubacel.cu'");
     // send the remarketing
     $log = "";
     foreach ($people as $person) {
         // get the email address
         $newEmail = "apretaste+{$person->username}@gmail.com";
         // create the variabels to pass to the template
         $content = array("newemail" => $newEmail, "name" => $person->first_name);
         // create html response
         $response->setEmailLayout("email_simple.tpl");
         $response->createFromTemplate('newEmail.tpl', $content);
         $response->internal = true;
         $html = $render->renderHTML($service, $response);
         // send the email
         $email->sendEmail($person->email, "Sorteando las dificultades, un email lleno de alegria", $html);
         $log .= $person->email . "\n";
     }
     // saving the log
     $logger = new \Phalcon\Logger\Adapter\File("{$wwwroot}/logs/newemail.log");
     $logger->log($log);
     $logger->close();
 }
开发者ID:Apretaste,项目名称:Core,代码行数:34,代码来源:NewemailTask.php

示例6: queueNewUser

 /**
  * public queueNewUser($email, $password)
  *
  * Creates a new user and stores it in the TEMP database, setting
  * the local object's data. It then sends an email with an activation links.
  * 
  * Returns true on success.
  */
 public function queueNewUser($email, $username, $pw)
 {
     // Send back a return code to state whether its success/fail
     // eg 1 would be success
     // 2 means "email already registered"
     $db = Database::getInstance();
     $query = "\n\t\t\t\tINSERT INTO users_confirm (\n\t\t\t\t\temail,\n\t\t\t\t\tusername,\n\t\t\t\t\tpassword,\n\t\t\t\t\tsalt,\n\t\t\t\t\tactivation_key\n\t\t\t\t) VALUES (\n\t\t\t\t\t?,\n\t\t\t\t\t?,\n\t\t\t\t\t?,\n\t\t\t\t\t?,\n\t\t\t\t\t?\n\t\t\t\t)\n\t\t\t";
     $salt = dechex(mt_rand(0, 2147483647)) . dechex(mt_rand(0, 2147483647));
     // This hashes the password with the salt so it can be stored securely.
     $password = hash('sha256', $pw . $salt);
     // Next we hash the hash value 65536 more times.  The purpose of this is to
     // protect against brute force attacks.  Now an attacker must compute the hash 65537
     // times for each guess they make against a password, whereas if the password
     // were hashed only once the attacker would have been able to make 65537 different
     // guesses in the same amount of time instead of only one.
     for ($round = 0; $round < 65536; $round++) {
         $password = hash('sha256', $password . $salt);
     }
     // Uncomment to actually register accounts
     $key = md5(time());
     $db->query($query, array($email, $username, $password, $salt, $key));
     $result = $db->firstResult();
     // Send email
     $em = new Email();
     $em->sendEmail($email, "Confirm your account", "This is an email test, please use this key to register: " . $key, true);
     return true;
 }
开发者ID:galaxybuster,项目名称:tsk-mail,代码行数:35,代码来源:user.class.php

示例7: mainAction

 public function mainAction()
 {
     // inicialize supporting classes
     $timeStart = time();
     $connection = new Connection();
     $email = new Email();
     $service = new Service();
     $service->showAds = true;
     $render = new Render();
     $response = new Response();
     $utils = new Utils();
     $wwwroot = $this->di->get('path')['root'];
     $log = "";
     // people who were invited but never used Apretaste
     $invitedPeople = $connection->deepQuery("\n\t\t\tSELECT invitation_time, email_inviter, email_invited\n\t\t\tFROM invitations \n\t\t\tWHERE used=0 \n\t\t\tAND DATEDIFF(CURRENT_DATE, invitation_time) > 15 \n\t\t\tAND email_invited NOT IN (SELECT DISTINCT email from delivery_dropped)\n\t\t\tAND email_invited NOT IN (SELECT DISTINCT email from remarketing)\n\t\t\tORDER BY invitation_time DESC\n\t\t\tLIMIT 450");
     // send the first remarketing
     $log .= "\nINVITATIONS (" . count($invitedPeople) . ")\n";
     foreach ($invitedPeople as $person) {
         // check number of days since the invitation was sent
         $datediff = time() - strtotime($person->invitation_time);
         $daysSinceInvitation = floor($datediff / (60 * 60 * 24));
         // validate old invitations to avoid bounces
         if ($daysSinceInvitation > 60) {
             // re-validate the email
             $res = $utils->deepValidateEmail($person->email_invited);
             // if response not ok or temporal, delete from invitations list
             if ($res[0] != "ok" && $res[0] != "temporal") {
                 $connection->deepQuery("DELETE FROM invitations WHERE email_invited = '{$person->email_invited}'");
                 $log .= "\t --skiping {$person->email_invited}\n";
                 continue;
             }
         }
         // send data to the template
         $content = array("date" => $person->invitation_time, "inviter" => $person->email_inviter, "invited" => $person->email_invited, "expires" => strtotime('next month'));
         // create html response
         $response->createFromTemplate('pendinginvitation.tpl', $content);
         $response->internal = true;
         $html = $render->renderHTML($service, $response);
         // send the invitation email
         $subject = "Su amigo {$person->email_inviter} esta esperando por usted!";
         $email->sendEmail($person->email_invited, $subject, $html);
         // insert into remarketing table
         $connection->deepQuery("INSERT INTO remarketing(email, type) VALUES ('{$person->email_invited}', 'INVITE')");
         // display notifications
         $log .= "\t{$person->email_invited}\n";
     }
     // get final delay
     $timeEnd = time();
     $timeDiff = $timeEnd - $timeStart;
     // printing log
     $log .= "EXECUTION TIME: {$timeDiff} seconds\n\n";
     echo $log;
     // saving the log
     $logger = new \Phalcon\Logger\Adapter\File("{$wwwroot}/logs/remarketing_invitation.log");
     $logger->log($log);
     $logger->close();
     // save the status in the database
     $connection->deepQuery("UPDATE task_status SET executed=CURRENT_TIMESTAMP, delay='{$timeDiff}' WHERE task='invitation'");
 }
开发者ID:Apretaste,项目名称:Core,代码行数:59,代码来源:InvitationTask.php

示例8: email

function email($subject, $body)
{
    require_once "../includes/email.php";
    $email = new Email();
    $email->subject = $subject;
    $email->body = $body;
    $email->sendEmail();
}
开发者ID:Garamore,项目名称:clemsoncfa,代码行数:8,代码来源:getIssues.php

示例9: mainAction

 public function mainAction()
 {
     // inicialize supporting classes
     $timeStart = time();
     $utils = new Utils();
     $connection = new Connection();
     $sender = new Email();
     // get the first campaign created that is waiting to be sent
     $campaign = $connection->deepQuery("\n\t\t\tSELECT id, subject, content\n\t\t\tFROM campaign\n\t\t\tWHERE sending_date < CURRENT_TIMESTAMP\n\t\t\tAND status = 'WAITING'\n\t\t\tGROUP BY sending_date ASC\n\t\t\tLIMIT 1");
     // check if there are not campaigns
     if (empty($campaign)) {
         return;
     } else {
         $campaign = $campaign[0];
     }
     // check campaign as SENDING
     $connection->deepQuery("UPDATE campaign SET status='SENDING' WHERE id = {$campaign->id}");
     // get the list of people in the list who hsa not receive this campaign yet
     // so in case the campaign fails when it tries again starts from the same place
     $people = $connection->deepQuery("\n\t\t\tSELECT email FROM person\n\t\t\tWHERE mail_list=1 AND active=1\n\t\t\tAND email NOT IN (SELECT email FROM campaign_sent WHERE campaign={$campaign->id})");
     // show initial message
     $total = count($people);
     echo "\nSTARTING COUNT: {$total}\n";
     // email people one by one
     $counter = 1;
     foreach ($people as $person) {
         // show message
         echo "{$counter}/{$total} - {$person->email}\n";
         $counter++;
         // replace the template variables
         $content = $utils->campaignReplaceTemplateVariables($person->email, $campaign->content, $campaign->id);
         // send test email
         $sender->trackCampaign = $campaign->id;
         $result = $sender->sendEmail($person->email, $campaign->subject, $content);
         // add to bounced and unsubscribe if there are issues sending
         $bounced = "";
         $status = "SENT";
         if (!$result) {
             $utils->unsubscribeFromEmailList($person->email);
             $bounced = "bounced=bounced+1,";
             $status = "BOUNCED";
         }
         // save status before moving to the next email
         $connection->deepQuery("\n\t\t\t\tINSERT INTO campaign_sent (email, campaign, status) VALUES ('{$person->email}', '{$campaign->id}', '{$status}');\n\t\t\t\tUPDATE campaign SET {$bounced} sent=sent+1 WHERE id='{$campaign->id}'");
     }
     // set the campaign as SENT
     $connection->deepQuery("UPDATE campaign SET status='SENT' WHERE id='{$campaign->id}'");
     // get final delay
     $timeEnd = time();
     $timeDiff = $timeEnd - $timeStart;
     // saving the log
     $wwwroot = $this->di->get('path')['root'];
     $logger = new \Phalcon\Logger\Adapter\File("{$wwwroot}/logs/campaigns.log");
     $logger->log("ID: {$campaign->id}, RUNTIME: {$timeDiff}, SUBJECT: {$campaign->subject}");
     $logger->close();
     // save the status in the database
     $connection->deepQuery("UPDATE task_status SET executed=CURRENT_TIMESTAMP, delay='{$timeDiff}' WHERE task='campaign'");
 }
开发者ID:Apretaste,项目名称:Core,代码行数:58,代码来源:CampaignTask.php

示例10: indexAction

 public function indexAction()
 {
     $email = new Email();
     $images = array("/home/salvipascual/Pictures/pascuals.jpg", "/home/salvipascual/Pictures/pascuals.png");
     $body = '<html>Inline image:<img alt="image1" src="cid:pascuals.jpg"><br/><img alt="image2" src="cid:pascuals.png"></html>';
     echo $email->deliveryStatus("apretaste@recipescookbook.org");
     exit;
     $email->sendEmail("apretaste@recipescookbook.org", "Test", $body);
     echo "Email sent";
 }
开发者ID:ChrisClement,项目名称:Core,代码行数:10,代码来源:TestController.php

示例11: sendPasswordLink

 public function sendPasswordLink($email)
 {
     try {
         $mailer = new Email();
         $this->email['body'] .= $this->email['reset_link'] . $this->token;
         if ($mailer->sendEmail($email, $this->email['subject'], $this->email['body'])) {
             $this->saveToken($email);
         }
         return true;
     } catch (Swift_SwiftException $e) {
         return false;
     }
 }
开发者ID:Adrian268,项目名称:comp296,代码行数:13,代码来源:PasswordReset.php

示例12: mainAction

 public function mainAction()
 {
     // inicialize supporting classes
     $timeStart = time();
     $connection = new Connection();
     $email = new Email();
     $service = new Service();
     $service->showAds = true;
     $render = new Render();
     $response = new Response();
     $utils = new Utils();
     $wwwroot = $this->di->get('path')['root'];
     $log = "";
     // people in the list to be automatically invited
     $people = $connection->deepQuery("\n\t\t\tSELECT * FROM autoinvitations\n\t\t\tWHERE email NOT IN (SELECT email FROM person)\n\t\t\tAND email NOT IN (SELECT DISTINCT email FROM delivery_dropped)\n\t\t\tAND email NOT IN (SELECT DISTINCT email from remarketing)\n\t\t\tAND error=0\n\t\t\tLIMIT 450");
     // send the first remarketing
     $log .= "\nAUTOMATIC INVITATIONS (" . count($people) . ")\n";
     foreach ($people as $person) {
         // if response not ok, check the email as error
         $res = $utils->deepValidateEmail($person->email);
         if ($res[0] != "ok") {
             $connection->deepQuery("UPDATE autoinvitations SET error=1, processed=CURRENT_TIMESTAMP WHERE email='{$person->email}'");
             $log .= "\t --skiping {$person->email}\n";
             continue;
         }
         // create html response
         $content = array("email" => $person->email);
         $response->createFromTemplate('autoinvitation.tpl', $content);
         $response->internal = true;
         $html = $render->renderHTML($service, $response);
         // send invitation email
         $subject = "Dos problemas, y una solucion";
         $email->sendEmail($person->email, $subject, $html);
         // mark as sent
         $connection->deepQuery("\n\t\t\t\tSTART TRANSACTION;\n\t\t\t\tDELETE FROM autoinvitations WHERE email='{$person->email}';\n\t\t\t\tINSERT INTO remarketing(email, type) VALUES ('{$person->email}', 'AUTOINVITE');\n\t\t\t\tCOMMIT;");
         // display notifications
         $log .= "\t{$person->email}\n";
     }
     // get final delay
     $timeEnd = time();
     $timeDiff = $timeEnd - $timeStart;
     // printing log
     $log .= "EXECUTION TIME: {$timeDiff} seconds\n\n";
     echo $log;
     // saving the log
     $logger = new \Phalcon\Logger\Adapter\File("{$wwwroot}/logs/remarketing_autoinvitation.log");
     $logger->log($log);
     $logger->close();
     // save the status in the database
     $connection->deepQuery("UPDATE task_status SET executed=CURRENT_TIMESTAMP, delay='{$timeDiff}' WHERE task='autoinvitation'");
 }
开发者ID:Apretaste,项目名称:Core,代码行数:51,代码来源:AutoinvitationTask.php

示例13: migrateProfiles

 /**
  * Migrar los perfiles con formato anterior a v1.2
  *
  * @return bool
  */
 public static function migrateProfiles()
 {
     $query = 'SELECT userprofile_id AS id,' . 'userprofile_name AS name,' . 'BIN(userProfile_pView) AS pView,' . 'BIN(userProfile_pViewPass) AS pViewPass,' . 'BIN(userProfile_pViewHistory) AS pViewHistory,' . 'BIN(userProfile_pEdit) AS pEdit,' . 'BIN(userProfile_pEditPass) AS pEditPass,' . 'BIN(userProfile_pAdd) AS pAdd,' . 'BIN(userProfile_pDelete) AS pDelete,' . 'BIN(userProfile_pFiles) AS pFiles,' . 'BIN(userProfile_pConfig) AS pConfig,' . 'BIN(userProfile_pConfigMasterPass) AS pConfigMasterPass,' . 'BIN(userProfile_pConfigBackup) AS pConfigBackup,' . 'BIN(userProfile_pAppMgmtCategories) AS pAppMgmtCategories,' . 'BIN(userProfile_pAppMgmtCustomers) AS pAppMgmtCustomers,' . 'BIN(userProfile_pUsers) AS pUsers,' . 'BIN(userProfile_pGroups) AS pGroups,' . 'BIN(userProfile_pProfiles) AS pProfiles,' . 'BIN(userProfile_pEventlog) AS pEventlog ' . 'FROM usrProfiles';
     DB::setReturnArray();
     $queryRes = DB::getResults($query, __FUNCTION__);
     if ($queryRes === false) {
         Log::writeNewLog(_('Migrar Perfiles'), _('Error al obtener perfiles'));
         return false;
     }
     foreach ($queryRes as $oldProfile) {
         $profile = new Profile();
         $profile->setId($oldProfile->id);
         $profile->setName($oldProfile->name);
         $profile->setAccAdd($oldProfile->pAdd);
         $profile->setAccView($oldProfile->pView);
         $profile->setAccViewPass($oldProfile->pViewPass);
         $profile->setAccViewHistory($oldProfile->pViewHistory);
         $profile->setAccEdit($oldProfile->pEdit);
         $profile->setAccEditPass($oldProfile->pEditPass);
         $profile->setAccDelete($oldProfile->pDelete);
         $profile->setConfigGeneral($oldProfile->pConfig);
         $profile->setConfigEncryption($oldProfile->pConfigMasterPass);
         $profile->setConfigBackup($oldProfile->pConfigBackup);
         $profile->setMgmCategories($oldProfile->pAppMgmtCategories);
         $profile->setMgmCustomers($oldProfile->pAppMgmtCustomers);
         $profile->setMgmUsers($oldProfile->pUsers);
         $profile->setMgmGroups($oldProfile->pGroups);
         $profile->setMgmProfiles($oldProfile->pProfiles);
         $profile->setEvl($oldProfile->pEventlog);
         if ($profile->profileUpdate() === false) {
             return false;
         }
     }
     $query = 'ALTER TABLE usrProfiles ' . 'DROP COLUMN userProfile_pAppMgmtCustomers,' . 'DROP COLUMN userProfile_pAppMgmtCategories,' . 'DROP COLUMN userProfile_pAppMgmtMenu,' . 'DROP COLUMN userProfile_pUsersMenu,' . 'DROP COLUMN userProfile_pConfigMenu,' . 'DROP COLUMN userProfile_pFiles,' . 'DROP COLUMN userProfile_pViewHistory,' . 'DROP COLUMN userProfile_pEventlog,' . 'DROP COLUMN userProfile_pEditPass,' . 'DROP COLUMN userProfile_pViewPass,' . 'DROP COLUMN userProfile_pDelete,' . 'DROP COLUMN userProfile_pProfiles,' . 'DROP COLUMN userProfile_pGroups,' . 'DROP COLUMN userProfile_pUsers,' . 'DROP COLUMN userProfile_pConfigBackup,' . 'DROP COLUMN userProfile_pConfigMasterPass,' . 'DROP COLUMN userProfile_pConfig,' . 'DROP COLUMN userProfile_pAdd,' . 'DROP COLUMN userProfile_pEdit,' . 'DROP COLUMN userProfile_pView';
     $queryRes = DB::getQuery($query, __FUNCTION__);
     $log = new Log(_('Migrar Perfiles'));
     if ($queryRes) {
         $log->addDescription(_('Operación realizada correctamente'));
     } else {
         $log->addDescription(_('Migrar Perfiles'), _('Fallo al realizar la operación'));
     }
     $log->writeLog();
     Email::sendEmail($log);
     return $queryRes;
 }
开发者ID:bitking,项目名称:sysPass,代码行数:50,代码来源:Profile.class.php

示例14: mainAction

 public function mainAction()
 {
     // inicialize supporting classes
     $timeStart = time();
     $connection = new Connection();
     $email = new Email();
     $service = new Service();
     $service->showAds = true;
     $render = new Render();
     $response = new Response();
     $wwwroot = $this->di->get('path')['root'];
     $log = "";
     // get people who did not finish a survey for the last 3 days
     $surveys = $connection->deepQuery("\n\t\t\tSELECT A.*, B.title, B.deadline, B.value FROM \n\t\t\t(\n\t\t\t\tSELECT email, survey,  \n\t\t\t\tDATEDIFF(CURRENT_DATE, MAX(date_choosen)) as days_since,\n\t\t\t\t(\n\t\t\t\t\tSELECT COUNT(*) \n\t\t\t\t\tFROM _survey_question \n\t\t\t\t\tWHERE _survey_question.survey = _survey_answer_choosen.survey\n\t\t\t\t) as total, \n\t\t\t\tCOUNT(question) as choosen from _survey_answer_choosen GROUP BY email, survey\n\t\t\t) A\n\t\t\tJOIN _survey B\n\t\t\tON A.survey = B.id\n\t\t\tWHERE A.total > A.choosen \n\t\t\tAND A.days_since >= 7\n\t\t\tAND B.active = 1\n\t\t\tAND DATEDIFF(B.deadline, B.date_created) > 0\n\t\t\tAND A.email NOT IN (SELECT DISTINCT email FROM remarketing WHERE type='SURVEY')");
     // send emails to users
     $log .= "\nSURVEY REMARKETING (" . count($surveys) . ")\n";
     foreach ($surveys as $survey) {
         $content = array("survey" => $survey->survey, "days" => $survey->days_since, "missing" => $survey->total - $survey->choosen, "title" => $survey->title, "deadline" => $survey->deadline, "value" => $survey->value);
         // create html response
         $response->setResponseSubject("No queremos que pierda \${$survey->value}");
         $response->createFromTemplate('surveyReminder.tpl', $content);
         $response->internal = true;
         // send email to the person
         $html = $render->renderHTML($service, $response);
         $email->sendEmail($survey->email, $response->subject, $html);
         // add entry to remarketing
         $connection->deepQuery("INSERT INTO remarketing(email, type) VALUES ('{$survey->email}', 'SURVEY');");
         // display notifications
         $log .= "\t{$survey->email} | surveyID: {$survey->survey} \n";
     }
     // get final delay
     $timeEnd = time();
     $timeDiff = $timeEnd - $timeStart;
     // printing log
     $log .= "EXECUTION TIME: {$timeDiff} seconds\n\n";
     echo $log;
     // saving the log
     $logger = new \Phalcon\Logger\Adapter\File("{$wwwroot}/logs/surveyreminder.log");
     $logger->log($log);
     $logger->close();
     // save the status in the database
     $connection->deepQuery("UPDATE task_status SET executed=CURRENT_TIMESTAMP, delay='{$timeDiff}' WHERE task='survey'");
 }
开发者ID:Apretaste,项目名称:Core,代码行数:43,代码来源:SurveyTask.php

示例15: actionSendEmail

 public function actionSendEmail()
 {
     $sendType = Yii::app()->request->getParam('sendType');
     if (empty($sendType)) {
         exit;
     }
     $startTime = time();
     if ($sendType === 'daytime') {
         $startTime = time() - 60 * 5;
         //8-23点,每5分钟触发一次
     } elseif ($sendType === 'night') {
         $startTime = time() - 60 * 60 * 8;
         //晚上23-8点 在8点触发一次
     }
     $status = 10;
     //取某个状态下的日志
     $rentalcarsApiLog_model = RentalcarsApiLog::model()->findAll("ReturnTime>:returnTime and Status =:status", array(":returnTime" => $startTime, ":status" => $status));
     $rentalcarsApiLog_count = count($rentalcarsApiLog_model);
     if ($rentalcarsApiLog_count > 0) {
         $message = '<b>来自:百程资源系统-生产环境</b><br/><br/>';
         foreach ($rentalcarsApiLog_model as $key => $value) {
             $message .= '<b>编号:' . $value['Id'] . '<br/>';
             $message .= '接口名称:' . $value['InterfaceName'] . '<br/>';
             $message .= '请求时间:' . date('Y-m-d H:i:s', $value['RequestTime']) . '<br/>';
             $message .= '返回状态:异常状态-' . $value['Status'] . '</b><br/>';
             //$message.='<b>请求参数:</b><br/>'.$value['RequestParam'].'<br/>';
             //$message.='<b>返回值(Xml格式):</b><br/>'.$value['ReturnXml'].'<br/>';
             //$message.='<b>返回值(Json格式):</b><br/>'.$value['ReturnParam'].'<br/>';
             $message .= '=======================================================================';
             $message .= '<br/>';
         }
         //发送邮件
         // $emailStatus= Email::sendEmail(CARRENTALAPI_REQUESTEMAIL,'国际租车日志',$message);
         $emailStatus = Email::sendEmail(CARRENTALAPI_REQUESTEMAIL, '国际租车日志', $message, "smtp.baicheng.com", CARRENTALAPI_SENDEMAIL_USERNAME, CARRENTALAPI_SENDEMAIL_PASSWORD, $attachment = false);
         if ($emailStatus) {
             echo 'send success!';
         } else {
             echo 'send error!';
         }
     } else {
         echo 'send content is null!';
     }
 }
开发者ID:lovecheng,项目名称:brs-demo2,代码行数:43,代码来源:LogManagerController.php


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