本文整理汇总了PHP中Mailer::Send方法的典型用法代码示例。如果您正苦于以下问题:PHP Mailer::Send方法的具体用法?PHP Mailer::Send怎么用?PHP Mailer::Send使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mailer
的用法示例。
在下文中一共展示了Mailer::Send方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: normal_send
/**
*
* @param string $key 配置key
* @param string $to 收件人
* @param string $subject 主题
* @param string $body 内容
*/
public static function normal_send($key, $to, $subject, $body, $toname = '')
{
$pzarr = Conf::$email[$key];
if ($pzarr['protocol'] == 'smtp') {
$mail = new Mailer();
$mail->IsSMTP();
$mail->Host = $pzarr['smtp_host'];
// SMTP server
$mail->SMTPDebug = 2;
// enables SMTP debug information (for testing)
$mail->SMTPAuth = true;
// enable SMTP authentication
$mail->Port = isset($pzarr['smtp_port']) ? $pzarr['smtp_port'] : 25;
// set the SMTP port for the GMAIL server
$mail->Username = $pzarr['smtp_user'];
// SMTP account username
$mail->Password = $pzarr['smtp_pass'];
// SMTP account password
$mail->AddReplyTo($pzarr['from'][0], $pzarr['from'][1]);
$mail->SetFrom($pzarr['from'][0], $pzarr['from'][1]);
$mail->AddAddress($to, $toname);
$mail->Subject = $subject;
$mail->Body = $body;
$mail->IsHTML();
$mail->Send();
}
}
示例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)
{
$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 == "";
}
}
示例4: remind
function remind($curr)
{
//update reminder value
$assessments = getLastAssessment($curr);
$update = QueryFactory::Build("update");
$update->Table("assessments")->Where(["id", "=", $curr["id"]], ["TestNumber", "=", $assessments["TestNumber"]])->Set(["reminded", "1"]);
$cinfo = DatabaseManager::Query($complete);
//write email
Mailer::Send($curr["email"], "This is an email reminder that your Sit And Be Fit assessment is due in a week./nPlease go to sbfresearch.org and login to complete the assessment");
}
示例5: sendMail
protected function sendMail()
{
$mail = new Mailer();
$mail->From = $_REQUEST['emailFrom'];
$mail->FromName = $_REQUEST['emailFrom'];
foreach (explode(",", $_REQUEST['emailTo']) as $emailTo) {
$mail->AddAddress($emailTo);
}
$mail->Subject = $_REQUEST['subject'];
//$mail->setBodyFromTemplate($data=array(), $template="mail_generic", $altBody=""
$mail->setBodyFromTemplate(array('body' => $_REQUEST['body']));
return $mail->Send();
}
示例6: actionPerform
function actionPerform($eventName, $args)
{
$mailer = new Mailer($this->main);
$mailTemplate = new MailTemplate($this->main);
$mailTemplate->assign('username', $args);
$mailer->addSystemAddress();
if ($eventName == "login_fail") {
$mailer->Subject = $mailTemplate->fetch('event/loginFailSubject');
$mailer->Body = $mailTemplate->fetch('event/loginFaildBody');
$mailer->Send();
} elseif ($eventName == "login_succeed") {
$mailer->Subject = $mailTemplate->fetch('event/loginSucceedSubject');
$mailer->Body = $mailTemplate->fetch('event/loginSucceedBody');
$mailer->Send();
} elseif ($eventName == "user_activate") {
$mailer->Subject = $mailTemplate->fetch('event/userActivateSubject_Admin');
$mailer->Body = $mailTemplate->fetch('event/userActivateBody_Admin');
$mailer->Send();
} elseif ($eventName == "user_deactivate") {
$mailer->Subject = $mailTemplate->fetch('event/userDeactivateSubject_Admin');
$mailer->Body = $mailTemplate->fetch('event/userDeactivateBody_Admin');
$mailer->Send();
}
}
示例7: actionPerform
function actionPerform(&$skin, $moduleID)
{
$skin->main->controlVariables["feedBack"]['tabId'] = $skin->main->selectedTab;
$skin->main->controlVariables["feedBack"]['error'] = false;
$skin->main->controlVariables["feedBack"]['succeed'] = false;
if (isset($_POST["event"]) && $_POST["event"] == 'feedBack') {
$mailer = new Mailer($skin->main);
$mailer->AddAddress($mailer->From, $mailer->FromName);
$mailer->Subject = "FeedBack from your web site";
$mailer->Body = $_POST["content"];
$mailer->Send();
$skin->main->controlVariables["feedBack"]['errorInfo'] = $mailer->ErrorInfo != "";
$skin->main->controlVariables["feedBack"]['succeed'] = $mailer->ErrorInfo == "";
}
}
示例8: 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 == "";
}
}
示例9: sendMail
public function sendMail($project, $submodule, $message)
{
$projectUids = Common::checkboxStrDecode($project['monitors']);
$submoduleUids = Common::checkboxStrDecode($submodule['monitors']);
$uids = array_merge($projectUids, $submoduleUids);
$monitorDB = new MonitorModelDB();
$monitorsMail = $monitorDB->getData('SELECT email FROM ' . $monitorDB->getTableName() . ' WHERE id in ?', array($uids));
$mail = new Mailer();
$mail->setSubject("{$project['name']}的{$submodule['name']}({$submodule['code']})错误");
$mail->MsgHTML("错误详细:{$message}");
foreach ($monitorsMail as $monitorMail) {
$mail->AddAddress($monitorMail['email']);
}
$mail->Send();
$warningMessageDB = new WarningMessageModelDB();
$warningMessageDB->insert(array('type' => 1, 'message' => "{$project['name']}的{$submodule['name']}({$submodule['code']})错误:{$message}", 'monitors' => Common::checkboxStrEncode($uids), 'create_time' => time()));
}
示例10: 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);
}
示例11: index
public function index()
{
$this->load->library('url');
$this->document->title = $this->language->get('heading_title');
if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) {
$this->load->library('email/mailer');
$mailer = new Mailer();
$subject = "Sugerencias NecoTienda";
$message .= "<p>Dominio:<b>" . $this->request->post['domain'] . "</b></p><br />";
$message .= "<p>IP Browser:<b>" . $this->request->post['remote_ip'] . "</b></p><br />";
$message .= "<p>IP Server:<b>" . $this->request->post['server_ip'] . "</b></p><br />";
$message .= "<p>Cliente ID:<b>" . C_CODE . "</b></p><br />";
$message .= "<p>Sugerencia:<b>" . HTTP_HOME . "</b></p><br />";
$message .= "<p>" . $this->request->post['feedback'] . "</p>";
$message .= "<hr />";
$message .= "Server Vars:" . serialize($_SERVER);
if ($this->config->get('config_smtp_method') == 'smtp') {
$mailer->IsSMTP();
$mailer->Host = $this->config->get('config_smtp_host');
$mailer->Username = $this->config->get('config_smtp_username');
$mailer->Password = base64_decode($this->config->get('config_smtp_password'));
$mailer->Port = $this->config->get('config_smtp_port');
$mailer->Timeout = $this->config->get('config_smtp_timeout');
$mailer->SMTPSecure = $this->config->get('config_smtp_ssl');
$mailer->SMTPAuth = $this->config->get('config_smtp_auth') ? true : false;
} elseif ($this->config->get('config_smtp_method') == 'sendmail') {
$mailer->IsSendmail();
} else {
$mailer->IsMail();
}
$mailer->IsHTML();
$mailer->AddAddress("soporte@necotienda.com", "Support NecoTienda");
$mailer->SetFrom($this->config->get('config_email'), $this->config->get('config_name'));
$mailer->Subject = $subject;
$mailer->Body = $message;
$mailer->Send();
}
$this->response->setOutput($this->render(true), $this->config->get('config_compression'));
}
示例12: randomID
$user = $users->getFirst();
$userid = $user->get('userid');
$resetkey = randomID();
$expire = date('Y-m-d H:i:s', time() + 86400);
// create an entry in the password reset table
$reset = Model_UserReset::Create();
$reset->set('userid', $userid);
$reset->set('resetkey', $resetkey);
$reset->set('expire', $expire);
$reset->save();
// construct e-mail body
$mm = new Pagemill($pm->root()->fork());
$mm->setVariable('username', $user->get('username'));
$mm->setVariable('reseturl', sprintf('http://%s%s/password?userid=%d&resetkey=%s', $_SERVER['HTTP_HOST'], TYPEF_WEB_DIR, $userid, $resetkey));
$body = str_replace('&', '&', $mm->writeString('<pm:include template="/users/reset.eml" />', true));
// e-mail the user so they can reset their password
$mailer = new Mailer();
$mailer->Configure();
$mailer->IsHTML(true);
$mailer->AddAddress($_POST['email']);
$mailer->Subject = 'Request to Reset Password for ' . TYPEF_TITLE;
$mailer->Body = $body;
$mailer->Send();
$pm->setVariable('reset_email_sent', true);
Typeframe::Log('Request to reset password for ' . $_POST['email']);
} else {
$pm->setVariable('reset_email_failed', true);
}
}
// set template (controller is at root, but template lives in users directory
Typeframe::SetPageTemplate('/users/password-reset.html');
示例13: notifyReview
protected function notifyReview($page_id)
{
if (!$page_id) {
return false;
}
$this->load->auto('email/mailer');
$this->load->auto('content/page');
$this->load->auto('store/review');
$this->load->auto('marketing/newsletter');
$page_info = $this->modelPage->getById($page_id);
if ($page_info) {
$page = $this->modelNewsletter->getById($this->config->get('marketing_email_new_comment'));
$subject = $page['title'];
$message = str_replace("{%page_url%}", Url::createUrl('content/page', array('page_id' => $page_id)), $page['description']);
$message = str_replace("{%page_name%}", $page_info['title'], $message);
$mailer = new Mailer();
$reps = $this->modelReview->getCustomersReviewsByPageId($page_id);
foreach ($reps as $k => $v) {
$mailer->AddBCC($v['email'], $v['author']);
}
$mailer->AddBCC($this->config->get('config_email'), $this->config->get('config_name'));
if ($this->config->get('config_smtp_method') == 'smtp') {
$mailer->IsSMTP();
$mailer->Host = $this->config->get('config_smtp_host');
$mailer->Username = $this->config->get('config_smtp_username');
$mailer->Password = base64_decode($this->config->get('config_smtp_password'));
$mailer->Port = $this->config->get('config_smtp_port');
$mailer->Timeout = $this->config->get('config_smtp_timeout');
$mailer->SMTPSecure = $this->config->get('config_smtp_ssl');
$mailer->SMTPAuth = $this->config->get('config_smtp_auth') ? true : false;
} elseif ($this->config->get('config_smtp_method') == 'sendmail') {
$mailer->IsSendmail();
} else {
$mailer->IsMail();
}
$mailer->IsHTML();
$mailer->SetFrom($this->config->get('config_email'), $this->config->get('config_name'));
$mailer->Subject = $subject;
$mailer->Body = $message;
$mailer->Send();
}
}
示例14: register
/**
* Register the new user provided
* @param <type> $user
* @return boolean registration result
*/
public static function register($user)
{
$user->status = User::STATUS_NOT_CONFIRMED;
$user->created = time();
$newPassword = UserService::createPassword();
$user->password = md5($newPassword);
// Notify to the user
$mail = new Mailer();
$mail->From = 'admin@automotoocasion.com';
$mail->FromName = 'AutoMotoOcasion';
$mail->AddAddress($user->email);
$mail->Subject = Yii::t('user', 'AutoMotoOcasion registration');
$mail->setBodyFromTemplate(array('user' => $user, 'newPassword' => $newPassword), 'mail_register');
if ($mail->Send()) {
$user->save(false);
return true;
} else {
return false;
}
}
示例15: elseif
<ul class="formlist">
<li class="formlisttitle">' . l_t('Username') . '</li>
<li class="formlistfield"><input type="text" tabindex="1" maxlength=30 size=15 name="forgotUsername"></li>
<li class="formlistdesc">' . l_t('The webDiplomacy username of the account which you can\'t log in to.') . '</li>
<li><input type="submit" class="form-submit" value="' . l_t('Send code') . '"></li>
</ul>
</form>';
} elseif ($_REQUEST['forgotPassword'] == 2 && isset($_REQUEST['forgotUsername'])) {
try {
$forgottenUser = new User(0, $DB->escape($_REQUEST['forgotUsername']));
} catch (Exception $e) {
throw new Exception(l_t("Cannot find an account for the given username, please " . "<a href='logon.php?forgotPassword=1' class='light'>go back</a> and check your spelling."));
}
require_once l_r('objects/mailer.php');
$Mailer = new Mailer();
$Mailer->Send(array($forgottenUser->email => $forgottenUser->username), l_t('webDiplomacy forgotten password verification link'), l_t("You can use this link to get a new password generated:") . "<br>\r\n" . libAuth::email_validateURL($forgottenUser->email) . "&forgotPassword=3<br><br>\r\n\r\n" . l_t("If you have any further problems contact the server's admin at %s.", Config::$adminEMail) . "<br>");
print '<p>' . l_t('An e-mail has been sent with a verification link, which will allow you to have your password reset. ' . 'If you can\'t find the e-mail in your inbox try your junk folder/spam-box.') . '</p>';
} elseif ($_REQUEST['forgotPassword'] == 3 && isset($_REQUEST['emailToken'])) {
$email = $DB->escape(libAuth::emailToken_email($_REQUEST['emailToken']));
$userID = User::findEmail($email);
$newPassword = base64_encode(rand(1000000000, 2000000000));
$DB->sql_put("UPDATE wD_Users\r\n\t\t\t\tSET password=UNHEX('" . libAuth::pass_Hash($newPassword) . "')\r\n\t\t\t\tWHERE id=" . $userID . " LIMIT 1");
print '<p>' . l_t('Thanks for verifying your address, this is your new password, which you can ' . 'change once you have logged back on:') . '<br /><br />
<strong>' . $newPassword . '</strong></p>
<p><a href="logon.php" class="light">' . l_t('Back to log-on prompt') . '</a></p>';
}
} catch (Exception $e) {
print '<p class="notice">' . $e->getMessage() . '</p>';
}