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


PHP Emails::sendEmail方法代码示例

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


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

示例1: createAccount

 /**
  * Used (currently) in the installation script. Note: this function relies on the settings file having
  * been defined, along with an arbitrary encryption salt.
  * @param $accountInfo
  * @param bool $isCurrentUser
  * @return int
  */
 public static function createAccount($accountInfo, $isCurrentUser = false)
 {
     $accountInfo = Utils::sanitize($accountInfo);
     $encryptionSalt = Core::getEncryptionSalt();
     $accountType = $accountInfo["accountType"];
     $firstName = isset($accountInfo["firstName"]) && !empty($accountInfo["firstName"]) ? $accountInfo["firstName"] : "";
     $lastName = isset($accountInfo["lastName"]) && !empty($accountInfo["lastName"]) ? $accountInfo["lastName"] : "";
     $email = isset($accountInfo["email"]) && !empty($accountInfo["email"]) ? $accountInfo["email"] : "";
     $password = "";
     if (isset($accountInfo["password"]) && !empty($accountInfo["password"])) {
         $password = crypt($accountInfo["password"], $encryptionSalt);
     }
     // TODO - this is weird!
     $autoEmail = isset($accountInfo["accountType"]) ? $accountInfo["accountType"] : false;
     $L = Core::$language->getCurrentLanguageStrings();
     $now = Utils::getCurrentDatetime();
     $prefix = Core::getDbTablePrefix();
     $selectedDataTypes = Settings::getSetting("installedDataTypes");
     $selectedExportTypes = Settings::getSetting("installedExportTypes");
     $selectedCountries = Settings::getSetting("installedCountries");
     $result = Core::$db->query("\n\t\t\tINSERT INTO {$prefix}user_accounts (date_created, last_updated, date_expires, last_logged_in, account_type, \n\t\t\t\tfirst_name, last_name, email, password, selected_data_types, selected_export_types, selected_countries)\n\t\t\tVALUES ('{$now}', '{$now}', '{$now}', NULL, '{$accountType}', '{$firstName}', '{$lastName}', '{$email}', '{$password}',\n\t\t\t\t'{$selectedDataTypes}', '\${$selectedExportTypes}', '{$selectedCountries}')\n\t\t");
     $emailSent = false;
     // not used yet, but we should notify the user via the interface
     if ($autoEmail) {
         try {
             $content = $L["account_created_msg"] . "\n\n";
             if (isset($_SERVER["HTTP_REFERER"]) && !empty($_SERVER["HTTP_REFERER"])) {
                 $content .= "{$L["login_url_c"]} {$_SERVER["HTTP_REFERER"]}\n";
             }
             $content .= "{$L["email_c"]} {$email}\n{$L["password_c"]} {$accountInfo["password"]}\n";
             Emails::sendEmail(array("recipient" => $email, "subject" => $L["account_created"], "content" => $content));
             $emailSent = true;
         } catch (Exception $e) {
             $emailSent = false;
         }
     }
     $returnInfo = array("success" => $result["success"]);
     if ($result["success"]) {
         $accountID = mysqli_insert_id(Core::$db->getDBLink());
         if ($isCurrentUser) {
             Core::initSessions();
             $_SESSION["account_id"] = $accountID;
             Core::initUser(true);
         }
         $returnInfo["accountID"] = $accountID;
     }
     return $returnInfo;
 }
开发者ID:JaeHoYun,项目名称:generatedata,代码行数:55,代码来源:Account.class.php

示例2: createAccount

 /**
  * Used (currently) in the installation script. Note: this function relies on the settings file having
  * been defined, along with an arbitrary encryption salt.
  *
  * This is static because it's used during the installation process to create the default account. But in 
  * all other cases its used by the admin only.
  *
  * @param array $accountInfo
  */
 public static function createAccount($accountInfo)
 {
     $accountInfo = Utils::sanitize($accountInfo);
     $encryptionSalt = Core::getEncryptionSalt();
     $accountType = $accountInfo["accountType"];
     $firstName = $accountInfo["firstName"];
     $lastName = $accountInfo["lastName"];
     $email = $accountInfo["email"];
     $password = crypt($accountInfo["password"], $encryptionSalt);
     $autoEmail = isset($accountInfo["accountType"]) ? $accountInfo["accountType"] : false;
     $L = Core::$language->getCurrentLanguageStrings();
     $now = Utils::getCurrentDatetime();
     $prefix = Core::getDbTablePrefix();
     $result = Core::$db->query("\n\t\t\tINSERT INTO {$prefix}user_accounts (date_created, last_updated, date_expires, last_logged_in, account_type, \n\t\t\t\tfirst_name, last_name, email, password)\n\t\t\tVALUES ('{$now}', '{$now}', '{$now}', NULL, '{$accountType}', '{$firstName}', '{$lastName}', '{$email}', '{$password}')\n\t\t");
     if ($autoEmail) {
         $content = $L["account_created_msg"] + "\n";
         if (isset($_SERVER["HTTP_REFERER"]) && !empty($_SERVER["HTTP_REFERER"])) {
             $content .= "Login URL: {$_SERVER["HTTP_REFERER"]}\n";
         }
         $content .= "Email: {$email}\nPassword: {$accountInfo["password"]}\n";
         $response = Emails::sendEmail(array("recipient" => $email, "subject" => $L["account_created"], "content" => $content));
     }
     // if ($result["success"]) {
     // 	$accountID = mysql_insert_id();;
     // 	Core::initSessions();
     // 	$_SESSION["account_id"] = $accountID;
     // 	Core::initUser(true);
     // }
 }
开发者ID:GrimDerp,项目名称:vagrant-synthetic-data-machine,代码行数:38,代码来源:Account.class.php


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