本文整理汇总了PHP中Email::Send方法的典型用法代码示例。如果您正苦于以下问题:PHP Email::Send方法的具体用法?PHP Email::Send怎么用?PHP Email::Send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Email
的用法示例。
在下文中一共展示了Email::Send方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: forgot
function forgot()
{
if ($_POST) {
DB::escapePost();
$sql = '
SELECT * FROM {{users}} WHERE login=\'' . $_POST['login'] . '\'
';
$return = DB::getRow($sql);
if ($return) {
$pass = Funcs::generate_password(8);
$sql = '
UPDATE {{users}}
SET pass=MD5(\'' . $pass . '\')
WHERE login=\'' . $_POST['login'] . '\'
';
DB::exec($sql);
$text = '
Здравствуйте, ' . $return["login"] . '.<br />
Ваш новый пароль ' . $pass . '.<br />
Сменить пароль Вы можете в личном кабинете.
';
$mail = new Email();
$mail->To($return['email']);
$mail->Subject('Восстановление пароля на сайте www.' . str_replace("www.", "", $_SERVER["HTTP_HOST"]));
$mail->Text($text);
$mail->Send();
}
$this->redirect('/');
} else {
View::$layout = 'empty';
View::render('site/forgot');
}
}
示例2: send
public static function send($id)
{
foreach ($_POST as $key => $value) {
$_POST[$key] = htmlspecialchars(trim(strip_tags($value)));
}
if ($_SESSION['captcha_keystring'] == $_POST['kcaptcha'] && $_SESSION['captcha_keystring'] != '') {
$text = '';
foreach ($_POST as $name => $item) {
if ($_POST[$name . '_text'] && strpos($name, '_text') === false) {
if (strpos($name, '_area') !== false) {
$text .= '<b>' . $_POST[$name . '_text'] . ':</b> <br />' . nl2br($item) . '<br />';
} else {
$text .= '<b>' . $_POST[$name . '_text'] . ':</b> ' . $item . '<br />';
}
}
}
$mail = new Email();
$info = Tree::getInfo($id);
if (Funcs::$conf['mail'][$info['path']]) {
$mail->To(Funcs::$conf['mail'][$info['path']]);
} elseif (Funcs::$conf['settings']['email']) {
$mail->To(Funcs::$conf['settings']['email']);
} else {
return false;
}
$mail->Subject($_POST['subject'] . ' на сайте ' . $_SERVER['HTTP_HOST']);
$mail->Text($text);
$mail->Send();
return true;
} else {
return false;
}
}
示例3: Report
public static function Report()
{
$sql = 'SELECT * FROM {{orders}} WHERE loyalty=1 AND sent=0';
$list = DB::getAll($sql);
foreach ($list as $order) {
$sql = '
SELECT * FROM {{orders_items}}
WHERE orders=' . $order['id'] . '
';
$items = DB::getAll($sql);
$data = $order;
foreach ($items as $item) {
$temp = Tree::getInfo($item['tree']);
if ($temp['path'] != 'catalogopt') {
$data['list'][] = Catalog::getOne($item['tree']);
}
}
$text = View::getRenderEmpty('email/report', $data);
$mail = new Email();
$mail->Text($text);
$mail->Subject('Оставьте отзыв о товаре на сайте www.' . str_replace('www.', '', $_SERVER["HTTP_HOST"]));
$mail->From('robot@' . str_replace('www.', '', $_SERVER["HTTP_HOST"]));
$mail->To($order['email']);
$mail->Send();
$sql = '
UPDATE {{orders}}
SET sent=1
WHERE id=' . $order['id'] . '
';
DB::exec($sql);
}
}
示例4: emailAdmin
/**
* Email admin
* @param string $status Message status e.g. error, success, debug
* @param string $msg Message to email
* @param boolean $email Email to admin, default false
* @return boolean
*/
public static function emailAdmin($status, $msg)
{
// Check admin email constants are defined
if (!defined('EMAIL_FROM')) {
status::Output('ERROR', 'EMAIL_FROM not specified');
return;
}
if (!defined('AUTHOR_NAME')) {
status::Output('ERROR', 'AUTHOR_NAME not specified');
return;
}
if (!defined('AUTHOR_EMAIL')) {
status::Output('ERROR', 'AUTHOR_EMAIL not specified');
return;
}
// Create email
$email = new Email();
if (defined('EMAIL_SMTP') && EMAIL_SMTP) {
$email->setSMTPStream();
} else {
$email->setPHPMail();
}
// Set message
$email->addHTML("\n\t\t\t<p>CLI email from " . EMAIL_DOMAIN . ":<br />\n\t\t\tstatus: " . $status . "<br />\n\t\t\tmessage: " . nl2br($msg) . "\n\t\t\t</p>\n\t\t");
// Send to admin
$email->addRecipient(AUTHOR_EMAIL, AUTHOR_NAME);
if ($email->Send(EMAIL_FROM, 'CLI Message') && !\Sonic\Message::count('error')) {
return TRUE;
} else {
return FALSE;
}
}
示例5: addMessage
public static function addMessage($touser, $message)
{
$sql = '
INSERT INTO {{messages}}
SET
fromuser=' . $_SESSION['iuser']['id'] . ',
touser=' . $touser . ',
message=\'' . $message . '\',
cdate=NOW()
';
DB::exec($sql);
$sql = 'SELECT CONCAT(fname,\' \',lname) AS name, email FROM {{iusers}} WHERE id=' . $touser . '';
$row = DB::getRow($sql);
$toname = $row['name'];
$email = $row['email'];
if (trim($toname) == '') {
$toname = 'Неизвестный';
}
$text = '
Здравствуйте, ' . $toname . '!<br /><br />
' . $_SESSION['iuser']['name'] . ' написал Вам новое сообщение на сайте <a href="http://' . $_SERVER['HTTP_HOST'] . '">' . $_SERVER['HTTP_HOST'] . '</a>.<br /><br />
';
$text = View::getRenderEmpty('email/simple', array('text' => $text, 'title' => 'Новое сообщение'));
$mail = new Email();
$mail->To($email);
$mail->Subject('Новое сообщение от ' . $_SESSION['iuser']['name'] . ' на сайте ' . $_SERVER['HTTP_HOST']);
$mail->Text($text);
$mail->Send();
}
示例6: action_register
/**
* 用户注册
*/
function action_register()
{
if ($_POST) {
$ip = Request::$client_ip;
$ipInfo = DB::select()->from('imgup_denyip')->where('ip_add', '=', $ip)->fetch_row();
if (!empty($ipInfo)) {
$this->show_message('IP: ' . $ip . ' 禁止注册,请联系客服!!');
}
//数据验证
$post = Validate::factory($_POST)->filter(TRUE, 'trim')->rule('username', 'regex', array('/^[^\'\\"\\:;,\\<\\>\\?\\/\\\\*\\=\\+\\{\\}\\[\\]\\)\\(\\^%\\$#\\!`\\s]+$/'))->rule('username', 'min_length', array('2'))->rule('username', 'max_length', array('10'))->rule('password', 'not_empty')->rule('password', 'min_length', array('6'))->rule('password', 'max_length', array('20'))->rule('email', 'not_empty')->rule('email', 'email')->rule('captcha', 'not_empty')->rule('captcha', 'Captcha::valid');
$user = ORM::factory('user');
// 验证
if ($post->check()) {
$exists = ORM::factory('user')->where('username', '=', $post['username'])->find();
$exists_email = ORM::factory('user')->where('email', '=', $post['email'])->find();
if (!empty($exists->username)) {
$this->show_message('该用户名已经存在,请换另一个' . $post['username']);
die;
}
if (!empty($exists_email->email)) {
$this->show_message('该邮箱已经存在,请换一个邮箱');
die;
}
$field = $user->field;
$user->reg_ip = Request::$client_ip;
$user->expire_time = strtotime(date('Y-m-d H:i:s', strtotime('+1 month')));
$user->values($post);
$user->reg_ip = Request::$client_ip;
$user->rank = 1;
$user->password = base64_encode($post['password']);
$user->save();
//存储其它信息
$field->uid = $user->uid;
$field->values($post)->save();
DB::update('users')->set(array('save_dir' => $user->uid . '_' . date('YmdHis')))->where('uid', '=', $user->uid)->execute();
// 首次登录
$userData = $user->login($user->uid);
$user->session_save('user', $userData);
/* $category = ORM::factory('img_category');
$category->uid = $user->uid;
$category->cate_name = '我的图册';
$category->description = '系统默认目录';
$category->type = 1;
$category->save();
*/
// 发邮件
Email::Send($post['username'], $post['email']);
$this->request->redirect('/user/success');
} else {
// 校验失败,获得错误提示
$str = '';
$this->template->registerErr = $errors = $post->errors('default/user/login');
foreach ($errors as $item) {
$str .= $item . '<br>';
}
$this->show_message($str);
}
}
}
示例7: send
private static function send($address, $subject, $text)
{
$mail = new Email();
$mail->To($address);
$mail->Subject($subject);
$mail->Text($text);
$mail->Send();
}
示例8: send
function send()
{
$emails = array();
$groups = array();
if (!isset($_POST['users']) and !isset($_POST['email'])) {
return;
}
$sqlGroups = '';
if (!empty($_POST['users'])) {
foreach ($_POST['users'] as $item) {
if ($item == 'iusers') {
$sql = 'SELECT email FROM {{iusers}} WHERE visible=1';
$emails = array_merge($emails, DB::getAll($sql, 'email'));
} elseif ($item == 'subscribers') {
$sql = 'SELECT email FROM {{subscribers}}';
$emails = array_merge($emails, DB::getAll($sql, 'email'));
} elseif ($item == 'orders') {
$sql = 'SELECT email FROM {{orders}}';
$emails = array_merge($emails, DB::getAll($sql, 'email'));
} else {
$groups[] = $item;
}
}
$sqlGroups = 'emailgroups=\'' . implode(',', $_POST['users']) . '\',';
}
if (!empty($groups)) {
$users = Iuser::getGroupUsers($groups, 'email');
$emails = array_merge($emails, $users);
}
$emails[] = $_POST['email'];
$emails = array_unique($emails);
$text = View::getRenderFullEmpty('email/notifications', array('text' => $_POST['body'], 'title' => $_POST['subject']));
foreach ($emails as $email) {
$mail = new Email();
$mail->Text($text);
$mail->Subject($_POST['subject']);
$mail->From($_POST['emailfrom']);
$mail->mailTo($email);
$mail->Send();
}
$sql = '
INSERT INTO {{notification}}
SET
subject=\'' . $_POST['subject'] . '\',
body=\'' . $_POST['body'] . '\',
email=\'' . implode(',', $emails) . '\',
' . $sqlGroups . '
emailfrom=\'' . $_POST['emailfrom'] . '\',
cdate=NOW(),
author=' . $_SESSION['user']['id'] . '
';
DB::exec($sql);
}
示例9: sendAllOrder
public static function sendAllOrder($id)
{
$data = Orders::getOrderById($id);
View::$layout = 'empty';
$text = View::getRenderFullEmpty('email/order', $data);
$mail = new Email();
$mail->mailTo($data['email']);
$mail->Subject('Статус заказа №' . (str_repeat('0', 6 - strlen($id)) . $id) . ' на сайте ' . $_SERVER['HTTP_HOST'] . ' изменен');
$mail->From('robot@' . str_replace('www.', '', $_SERVER["HTTP_HOST"]));
$mail->Text($text);
$mail->Send();
}
示例10: sendMailback
public function sendMailback()
{
DB::escapePost();
$text .= '<b>Имя:</b> ' . $_POST['name'] . '<br />';
$text .= '<b>Телефон:</b> ' . $_POST['phone'] . '<br />';
$text .= '<b>Email:</b> ' . $_POST['email'] . '<br />';
$text .= '<b>Сообщение:</b> ' . nl2br($_POST['message']) . '<br />';
View::$layout = 'empty';
$text = View::getRender('email/callback', array('text' => $text));
$mail = new Email();
$mail->mailTo(Funcs::$conf['email']['callback']);
$mail->Subject('Обратная связь на сайте ' . $_SERVER['HTTP_HOST']);
$mail->Text($text);
$mail->Send();
}
示例11: ask
public function ask($tree)
{
foreach ($_POST as $key => $value) {
$_POST[$key] = htmlspecialchars(trim(strip_tags($value)));
}
if ($_POST['kcaptcha'] == $_SESSION['captcha_keystring'] && $_POST['kcaptcha'] != '' && $_SESSION['captcha_keystring'] != '') {
$sql = '
INSERT INTO {{tree}}
SET
parent=' . $tree . ',
name=\'' . trim($_POST['question']) . '\',
path=\'' . Funcs::Transliterate(trim($_POST['question'])) . '\',
seo_title=\'' . trim($_POST['question']) . '\',
seo_keywords=\'' . trim($_POST['question']) . '\',
seo_description=\'' . trim($_POST['question']) . '\',
udate=NOW(),
cdate=NOW(),
visible=0,
site=' . $_SESSION['site'] . ',
num=0
';
$id = DB::exec($sql);
$sql = '
INSERT INTO {{relations}}
SET
modul1=\'tree\',
modul2=\'faq\',
id1=\'' . $id . '\',
id2=1,
cdate=NOW()
';
DB::exec($sql);
//Fields::insertField($id,'answer',$_POST['message']);
//Fields::insertField($id,'phone',$_POST['phone']);
$text = '
<b>Email:</b> <a href="mailto:' . trim($_POST['email']) . '">' . trim($_POST['email']) . '</a><br />
<b>Вопрос:</b> ' . trim($_POST['question']) . '<br />
';
$mail = new Email();
$mail->To(Funcs::$conf['email']['faq']);
$mail->Subject('Задан вопрос на сайте ' . $_SERVER['HTTP_HOST']);
$mail->Text($text);
$mail->Send();
return false;
} else {
return true;
}
}
示例12: sendMessage
public function sendMessage()
{
Funcs::escapePost();
//if($_POST['kcaptcha']==$_SESSION['captcha_keystring'] && $_POST['kcaptcha']!='' && $_SESSION['captcha_keystring']!=''){
$text = '
<b>ФИО:</b> ' . $_POST['fio'] . '<br />
<b>Телефон:</b> ' . $_POST['tel'] . '<br />
<b>Email:</b> <a href="mailto:' . $_POST['email'] . '">' . $_POST['email'] . '</a><br />
<b>Тема:</b> ' . $_POST['theme'] . '<br />
<b>Сообщение:</b><br />' . nl2br($_POST['quest']) . '<br />
';
$mail = new Email();
$mail->To(Funcs::$conf['email']['feedback']);
$mail->Subject('Обратная связь на сайте ' . $_SERVER['HTTP_HOST']);
$mail->Text($text);
$mail->Send();
return false;
/*}else{
return true;
}*/
}
示例13: send
public function send()
{
$form = $this->getForm(Funcs::$uri[1]);
$text = '';
foreach ($this->getFields(Funcs::$uri[1]) as $item) {
if ($item['type'] == 'text') {
$text .= '<b>' . $item['name'] . '</b><br /> ' . nl2br($_POST[$item['path']]) . '<br />';
} elseif ($item['type'] == 'checkbox') {
if ($_POST[$item['path']]) {
$text .= '<b>' . $item['name'] . '</b><br />';
}
} else {
$text .= '<b>' . $item['name'] . '</b> ' . $_POST[$item['path']] . '<br />';
}
}
$mail = new Email();
$mail->mailTo($form["email"]);
$mail->Subject($form['theme']);
$mail->Text($text);
$mail->Send();
}
示例14: ForgotPwdGo
protected function ForgotPwdGo()
{
$sAuthUser = utils::ReadParam('auth_user', '', true, 'raw_data');
try {
UserRights::Login($sAuthUser);
// Set the user's language (if possible!)
$oUser = UserRights::GetUserObject();
if ($oUser == null) {
throw new Exception(Dict::Format('UI:ResetPwd-Error-WrongLogin', $sAuthUser));
}
if (!MetaModel::IsValidAttCode(get_class($oUser), 'reset_pwd_token')) {
throw new Exception(Dict::S('UI:ResetPwd-Error-NotPossible'));
}
if (!$oUser->CanChangePassword()) {
throw new Exception(Dict::S('UI:ResetPwd-Error-FixedPwd'));
}
$sTo = $oUser->GetResetPasswordEmail();
// throws Exceptions if not allowed
if ($sTo == '') {
throw new Exception(Dict::S('UI:ResetPwd-Error-NoEmail'));
}
// This token allows the user to change the password without knowing the previous one
$sToken = substr(md5(APPROOT . uniqid()), 0, 16);
$oUser->Set('reset_pwd_token', $sToken);
CMDBObject::SetTrackInfo('Reset password');
$oUser->DBUpdate();
$oEmail = new Email();
$oEmail->SetRecipientTO($sTo);
$sFrom = MetaModel::GetConfig()->Get('forgot_password_from');
if ($sFrom == '') {
$sFrom = $sTo;
}
$oEmail->SetRecipientFrom($sFrom);
$oEmail->SetSubject(Dict::S('UI:ResetPwd-EmailSubject'));
$sResetUrl = utils::GetAbsoluteUrlAppRoot() . 'pages/UI.php?loginop=reset_pwd&auth_user=' . urlencode($oUser->Get('login')) . '&token=' . urlencode($sToken);
$oEmail->SetBody(Dict::Format('UI:ResetPwd-EmailBody', $sResetUrl));
$iRes = $oEmail->Send($aIssues, true);
switch ($iRes) {
//case EMAIL_SEND_PENDING:
case EMAIL_SEND_OK:
break;
case EMAIL_SEND_ERROR:
default:
IssueLog::Error('Failed to send the email with the NEW password for ' . $oUser->Get('friendlyname') . ': ' . implode(', ', $aIssues));
throw new Exception(Dict::S('UI:ResetPwd-Error-Send'));
}
$this->DisplayLoginHeader();
$this->add("<div id=\"login\">\n");
$this->add("<h1>" . Dict::S('UI:Login:ForgotPwdForm') . "</h1>\n");
$this->add("<p>" . Dict::S('UI:ResetPwd-EmailSent') . "</p>");
$this->add("<form method=\"post\">\n");
$this->add("<table>\n");
$this->add("<tr><td colspan=\"2\" class=\"center v-spacer\"><input type=\"button\" onClick=\"window.close();\" value=\"" . Dict::S('UI:Button:Done') . "\" /></td></tr>\n");
$this->add("</table>\n");
$this->add("</form>\n");
$this->add("</div\n");
} catch (Exception $e) {
$this->DisplayForgotPwdForm(true, $e->getMessage());
}
}
示例15: strtolower
//debug(1, 1, 1);
$page = Page::get_from_alias('forgot');
if ($_REQUEST['forgot-email']) {
$email = strtolower($_POST['forgot-email']);
if ($krustomer = Customer::get_from_email($email)) {
// email found
$status = 1;
$mail = new Email();
$mail->AddAddress($krustomer->Email, $krustomer->full_name);
$mail->Subject = 'Madison & Rayne Password Reset';
// Creates a reset token
$reset_token = Customer::create_reset_token($krustomer->Email);
$insert_array = array('CustomerID' => $krustomer->CustomerID, 'token_id' => $reset_token, 'expires' => date("Y-m-d H:i:s", time() + 60 * 60));
dbi()->insert('password_reset_requests', $insert_array);
$mail->MsgHTML("<p>We have received a request to reset the password for your Madison & Rayne account.\n If you did not request that your password be reset, you can ignore this email.</p>\n <p>To reset your password, please click on the link below. Simply enter a new password\n of your choice. You will have one hour to reset your password before the link will no longer work.</p>\n <p>If you have any questions, please contact us at\n <a href='mailto:info@madisonandrayne.com'>info@madisonandrayne.com</a> or 1-855-626-3701. Thank you!</p>\n <p><a href='" . SITE_URL . "/forgot?token_id=" . $reset_token . "'>" . SITE_URL . "/forgot?token_id=" . $reset_token . "</a></p>");
$mail->Send();
Gadget::add_message('An email has been sent to you with a link to reset your password.');
Gadget::redirect('index');
die;
} else {
// no email found
Gadget::add_message('That email address was not found.');
}
} elseif (isset($_REQUEST['token_id'])) {
$_REQUEST = clean_input($_REQUEST);
$request = dbi()->q_1("SELECT * FROM password_reset_requests WHERE token_id = '" . $_REQUEST['token_id'] . "'");
if ($request) {
$_SESSION['token_id'] = $_REQUEST['token_id'];
// Check if it's expired or not!
if (date("Y-m-d H:i:s", time()) > $request->expires) {
Gadget::redirect('index');