本文整理汇总了PHP中mail类的典型用法代码示例。如果您正苦于以下问题:PHP mail类的具体用法?PHP mail怎么用?PHP mail使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了mail类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: passwordForget
function passwordForget($opt)
{
// PUEDEN EXISTIR 3 ESTADOS A LA OPERACION (status)
// 0: OPERACION EXITOSA
// 1: EL USUARIO YA EXISTE
// 2: EXISTIO UN ERROR AL CREARLO POR DB
// 3: NO SE PUDO ENVIAR EL EMAIL
$dbo = $this->db;
if ($dbo->isExists('users', 'email', $opt->email)) {
$where['email'] = $opt->email;
$matriz['opeToken'] = $this->getToken('users', 'opeToken');
if ($dbo->update('users', $matriz, $where)) {
$email = new mail();
if ($email->sendForgotMail($opt->email, $matriz['opeToken'])) {
$this->returnData(array("status" => 0));
} else {
$this->returnData(array("status" => 3));
}
} else {
$this->returnData(array("status" => 2));
}
} else {
$this->returnData(array("status" => 1));
}
}
示例2: testEmail
function testEmail()
{
$email = new mail();
if ($email->send($_POST['email'], '测试用户', '这是一封测试邮件!', '这是一封测试邮件!你看到此邮件,说明你的邮箱已经配置好了。欢迎来到' . '<a href="' . __WEB__ . '">' . C('WEB_NAME') . '</a><br /><a href="http://www.houdunwang.com"><img src="http://bbs.houdunwang.com/static/image/common/logo.png" alt="后盾PHP培训" /></a>')) {
$this->success('邮件发送成功');
}
$this->success('邮件发送失败');
}
示例3: executeQuery
function executeQuery($query)
{
$result = mysql_query($query, $this->handler);
if (!$result) {
$mail = new mail();
$error = mysql_error();
$mail->send_error_mail($query, $error);
}
return $result;
}
示例4: send
function send($email, $code)
{
$sendmail = new sendmail();
$mail = new mail();
$mail->setSmtpemailto($email);
$mail->setMailsubject("邮箱验证");
$mail->setMailbody("感谢你的支持,你的验证码为:" . $code);
$rs = $sendmail->send($mail);
return $rs;
}
示例5: unsubscribe
public function unsubscribe()
{
$mail_configs['appid'] = $this->appid;
$mail_configs['appkey'] = $this->appkey;
if ($this->sign_type != '') {
$mail_configs['sign_type'] = $this->sign_type;
}
$addressbook = new mail($mail_configs);
return $addressbook->unsubscribe($this->buildRequest());
}
示例6: execute
public function execute($function)
{
if (is_callable(array($this, $function))) {
try {
$this->{$function}();
} catch (Error_Cron $e) {
$mail = new mail(def::notify('mail'));
$mail->text(serialize($e))->send();
}
}
}
示例7: shutdown_handler
function shutdown_handler()
{
$error = error_get_last();
if ($error && ($error['type'] == E_ERROR || $error['type'] == E_PARSE || $error['type'] == E_COMPILE_ERROR)) {
if (strpos($error['message'], 'Allowed memory size') === 0) {
ob_end_clean();
$mail = new mail(def::notify('mail'));
$mail->text(serialize(query::$url) . serialize($error))->send();
} else {
ob_end_clean();
$mail = new mail(def::notify('mail'));
$mail->text(serialize(query::$url) . serialize($error))->send();
}
}
}
示例8: do_edit
/**
* 回复留言信息
*/
function do_edit($id)
{
//权限检查 得到所有可管理站点ID列表
role::check('contact_us_manage');
if (!$id) {
remind::set(Kohana::lang('o_global.bad_request'), 'user/contact_us');
}
if ($_POST) {
//获取留言信息,发邮件
$contact_us = Mycontact_us::instance($id)->get();
$email_flag = 'contact_us';
$title_param = array();
$content_param = array();
$content_param['{message}'] = strip_tags($_POST['return_message']);
if (mail::send_mail($email_flag, $contact_us['email'], $from_email = '', $title_param, $content_param)) {
$is_receive = 1;
remind::set(Kohana::lang('o_global.mail_send_success'), '', 'success');
} else {
$is_receive = 0;
remind::set(Kohana::lang('o_global.mail_send_error'), '', 'error');
}
$data = $_POST;
$data['active'] = 0;
$data['is_receive'] = $is_receive;
if (Mycontact_us::instance($id)->edit($data)) {
remind::set(Kohana::lang('o_user.message_handle_success'), request::referrer(), 'success');
} else {
remind::set(Kohana::lang('o_user.message_handle_error'), request::referrer(), 'error');
}
}
}
示例9: send
function send()
{
global $tpl, $opt, $login;
if (!$this->template_exists($this->name . '.tpl')) {
$tpl->error(ERROR_MAIL_TEMPLATE_NOT_FOUND);
}
$this->assign('template', $this->name);
$optn['mail']['contact'] = $opt['mail']['contact'];
$optn['page']['absolute_url'] = $opt['page']['absolute_url'];
$optn['format'] = $opt['locale'][$opt['template']['locale']]['format'];
$this->assign('opt', $optn);
$this->assign('to', $this->to);
$this->assign('from', $this->from);
$this->assign('subject', $this->subject);
$llogin['username'] = isset($login) ? $login->username : '';
$this->assign('login', $llogin);
$body = $this->fetch($this->main_template . '.tpl', '', $this->get_compile_id());
// check if the target domain exists if the domain does not
// exist, the mail is sent to the own domain (?!)
$domain = mail::getToMailDomain($this->to);
if (mail::is_existent_maildomain($domain) == false) {
return false;
}
$aAddHeaders = array();
$aAddHeaders[] = 'From: "' . $this->from . '" <' . $this->from . '>';
if ($this->replyTo !== null) {
$aAddHeaders[] = 'Reply-To: ' . $this->replyTo;
}
if ($this->returnPath !== null) {
$aAddHeaders[] = 'Return-Path: ' . $this->returnPath;
}
$mailheaders = implode("\n", array_merge($aAddHeaders, $this->headers));
return mb_send_mail($this->to, $opt['mail']['subject'] . $this->subject, $body, $mailheaders);
}
示例10: update
public static function update($argv)
{
global $_cache, $_user, $_db;
$result = 'succeed';
if (!$_user->user_id) {
return false;
}
if ($argv['password'] != '') {
if ($argv['repeat_password'] == '' || $argv['password'] != $argv['repeat_password']) {
return false;
}
}
session_start();
$cache_key = md5("activate_{$_user->user_id}");
$email = filter_var($argv['email'], FILTER_VALIDATE_EMAIL);
unset($argv['email']);
if ($email && $email != $_user->email && !isset($_SESSION['activate'][$cache_key])) {
//ÓÊÏäÒÑ´æÔÚ
if (self::get_one(array('email' => $email))) {
return 'email_exist';
}
mail::send_activate($email, $cache_key);
// $_cache->add($cache_key,$user->user_id.'_'.$email);
$_SESSION['activate'][$cache_key] = $_user->user_id . '_' . $email;
$result = 'email';
}
$argv = array_intersect_key($argv, self::$default_value);
if (!empty($argv)) {
$_db->update('users', $argv, array('user_id' => $_user->user_id));
$_cache->delete("user_{$user->user_id}");
}
return $result;
}
示例11: callback_demo
/**
* 模型id.php 内容模型或表单模型回调处理函数(需要一定的开发基础)
*
* 这是一个示例文件
*
* 函数格式:function callback_模型表名称($data) {}
* $data 就是表单的提交内容了
*/
function callback_demo($data)
{
// 由开发者二次开发
// 用于发送邮件
mail::set(App::$config);
mail::sendmail('收件人地址', '发信标题', '发信内容');
}
示例12: validURLCheck
/**
* Prueft die URL damit keine boesen URLS uebergeben werden koennen
* @param $param
*/
function validURLCheck($param)
{
if (strstr($param, '://')) {
// Der APP_ROOT muss in der URL vorkommen, sonfern es kein relativer Pfad ist
// HTTPS und HTTP
if (mb_strpos($param, APP_ROOT) !== 0 && mb_strpos(mb_str_replace("http://", "https://", $param), APP_ROOT) !== 0 && mb_strpos(mb_str_replace("https://", "http://", $param), APP_ROOT) !== 0) {
$text = "Dies ist eine automatische Mail.\nEs wurde eine mögliche XSS Attacke durchgefuehrt:\n";
$text .= "\nFolgende URL wurde versucht aufzurufen: \n" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
$text .= "\n\nIP des Aufrufers: " . $_SERVER['REMOTE_ADDR'];
$text .= "\n\nUserAgent: " . $_SERVER['HTTP_USER_AGENT'];
$text .= "\n\nAuffälliger Value: {$param}";
$mail = new mail(MAIL_ADMIN, 'no-reply@' . DOMAIN, 'Versuchte XSS Attacke', $text);
$mail->send();
die('Invalid URL detected');
}
}
}
示例13: create
public static function create($data)
{
$user = ORM::factory('User');
$user->create_user($data, array('username', 'password', 'email'));
$user->add_role('login');
$mail = mail::create('usercreated')->to($user->email)->tokenize(array('username' => $user->username))->send();
user::login(arr::get($data, 'email', ''), arr::get($data, 'password', ''));
}
示例14: compra
public static function compra($data)
{
// dd($data);
mail::send('correos.compra', $data, function ($messages) use($data) {
$messages->from(env('MAIL_USERNAME'), env('MAIL_NAME'));
$messages->subject(' 🏆 ¡Felicitaciones! Gracias por su Compra ...');
$messages->to($data["correo"]);
});
}
示例15: ajax_template
/**
* ajax get mail template by type
*/
public function ajax_template($type)
{
$mail = mail::content($type);
$this->template = new View('template_blank');
if (isset($mail['content_result'])) {
$this->template->content = $mail['content_result'];
} else {
$this->template->content = 'Hacking attempt';
}
}