本文整理汇总了PHP中Mailer::addUserAddress方法的典型用法代码示例。如果您正苦于以下问题:PHP Mailer::addUserAddress方法的具体用法?PHP Mailer::addUserAddress怎么用?PHP Mailer::addUserAddress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mailer
的用法示例。
在下文中一共展示了Mailer::addUserAddress方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionPerform
function actionPerform(&$skin, $moduleID)
{
$recordSet = $skin->main->databaseConnection->Execute("SELECT user_groups.* , COUNT(users.name) AS user_count \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{$skin->main->databaseTablePrefix}user_groups AS user_groups LEFT OUTER JOIN\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{$skin->main->databaseTablePrefix}users AS users\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tON\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tuser_groups.user_group_id = users.user_group_id\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tuser_groups.user_group_id>1\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGROUP BY\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tuser_groups.user_group_id");
//Check for error, if an error occured then report that error
if (!$recordSet) {
trigger_error("Unable to get user list\nreason is : " . $skin->main->databaseConnection->ErrorMsg());
} else {
$rows = $recordSet->GetRows();
$skin->main->controlVariables["sendMessage"]['groupList'] = $rows;
$skin->main->controlVariables["sendMessage"]['moduleId'] = $this->getModuleID($skin->main);
}
$skin->main->controlVariables["sendMessage"]['errorInfo'] = "";
$skin->main->controlVariables["sendMessage"]['succeed'] = false;
if (isset($_POST["event"]) && $_POST["event"] == 'sendMessage') {
$mailer = new Mailer($skin->main);
for ($i = 0; $i < sizeof($_POST["groups"]); $i++) {
$recordSet = $skin->main->databaseConnection->Execute("SELECT username FROM {$skin->main->databaseTablePrefix}users AS users WHERE user_group_id=" . $_POST['groups'][$i]);
if (!$recordSet) {
trigger_error("Unable to get group members\nreason is : " . $skin->main->databaseConnection->ErrorMsg());
return "";
} else {
$rows = $recordSet->GetRows();
for ($j = 0; $j < sizeof($rows); $j++) {
$mailer->addUserAddress($rows[$j]["username"]);
}
}
}
$mailer->Subject = $_POST["subject"];
$mailer->Body = $_POST["content"];
$mailer->Send();
$skin->main->controlVariables["sendMessage"]['errorInfo'] = $mailer->ErrorInfo;
$skin->main->controlVariables["sendMessage"]['succeed'] = $mailer->ErrorInfo == "";
}
}
示例2: actionPerform
function actionPerform(&$skin, $moduleID)
{
$recordSet = $skin->main->databaseConnection->Execute("SELECT * FROM {$skin->main->databaseTablePrefix}users");
//Check for error, if an error occured then report that error
if (!$recordSet) {
trigger_error("Unable to get user list\nreason is : " . $skin->main->databaseConnection->ErrorMsg());
} else {
$rows = $recordSet->GetRows();
$skin->main->controlVariables["sendMessage"]['userList'] = $rows;
$skin->main->controlVariables["sendMessage"]['moduleId'] = $this->getModuleID($skin->main);
}
$skin->main->controlVariables["sendMessage"]['errorInfo'] = "";
$skin->main->controlVariables["sendMessage"]['succeed'] = false;
if (isset($_POST["event"]) && $_POST["event"] == 'sendMessage') {
$mailer = new Mailer($skin->main);
for ($i = 0; $i < sizeof($_POST["users"]); $i++) {
$mailer->addUserAddress($_POST["users"][$i]);
}
$mailer->Subject = $_POST["subject"];
$mailer->Body = $_POST["content"];
$mailer->Send();
$skin->main->controlVariables["sendMessage"]['errorInfo'] = $mailer->ErrorInfo;
$skin->main->controlVariables["sendMessage"]['succeed'] = $mailer->ErrorInfo == "";
}
}
示例3: actionPerform
function actionPerform(&$skin, $moduleID)
{
$username = $this->getUsername($skin->main);
$skin->main->controlVariables["sendMessage2User"]['username'] = $username;
$skin->main->controlVariables["sendMessage2User"]['errorInfo'] = "";
$skin->main->controlVariables["sendMessage2User"]['succeed'] = false;
if (isset($_POST["event"]) && $_POST["event"] == 'sendMessage2User' && $username != NULL) {
$mailer = new Mailer($skin->main);
$mailer->addUserAddress($username);
$mailer->Subject = $_POST["subject"];
$mailer->Body = $_POST["content"];
$mailer->Send();
$skin->main->controlVariables["sendMessage2User"]['errorInfo'] = $mailer->ErrorInfo;
$skin->main->controlVariables["sendMessage2User"]['succeed'] = $mailer->ErrorInfo == "";
}
}
示例4: actionPerform
function actionPerform(&$skin, $moduleID)
{
$usernameError = '';
if (isset($_POST["event"]) && $_POST["event"] == 'forgetPassword') {
//Check username
//Inorder to avoid sql injection attacks both
//should contains characters form a to z and/or numbers only
if (isset($_POST["username"]) && (!$skin->main->checkString('[^a-zA-Z0-9]', $_POST["username"]) || $_POST["username"] == "")) {
$usernameError = "Username must contains numbers and/or character from a to z only";
} else {
$query = "SELECT * FROM {$skin->main->databaseTablePrefix}users WHERE username=" . $skin->main->databaseConnection->qstr($_POST["username"]);
$recordSet = $skin->main->databaseConnection->Execute($query);
$password = $this->randomNumber();
$record = array('password' => md5($password));
//Start Update Transaction
$skin->main->databaseConnection->StartTrans();
$updateSQL = $skin->main->databaseConnection->GetUpdateSQL($recordSet, $record);
$skin->main->databaseConnection->Execute($updateSQL);
$recordSet2 = $skin->main->databaseConnection->Execute("SELECT * FROM {$skin->main->databaseTablePrefix}templates \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttype='mail'\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tname = 'forgetPasswordSubject'\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tOR\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tname = 'forgetPasswordBody'\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)");
$templates = array('forgetPasswordSubject' => '', 'forgetPasswordBody' => '');
while (!$recordSet2->EOF) {
$templates[$recordSet2->fields["name"]] = $recordSet2->fields["content"];
$recordSet2->MoveNext();
}
$mailer = new Mailer($skin->main);
$mailTemplate = new MailTemplate($skin->main);
$mailTemplate->assign('username', $_POST["username"]);
$mailTemplate->assign('password', $password);
$mailer->addUserAddress($_POST["username"]);
$mailer->Subject = $mailTemplate->fetch('mail/forgetPasswordSubject');
$mailer->Body = $mailTemplate->fetch('mail/forgetPasswordBody');
$mailer->Send();
if ($mailer->ErrorInfo) {
//Transaction failed
$skin->main->databaseConnection->FailTrans();
trigger_error("Unable to send password remind mail. Reason is : " . $mailer->ErrorInfo);
}
//Complete update transaction
$skin->main->databaseConnection->CompleteTrans();
}
}
//Assign codeBehind variables
$skin->main->controlVariables["forgetPassword"] = array('usernameError' => $usernameError);
}