Ejemplo n.º 1
0
Archivo: email.php Proyecto: Zocoo/zune
 function send($email, $code)
 {
     $sendmail = new sendmail();
     $mail = new mail();
     $mail->setSmtpemailto($email);
     $mail->setMailsubject("邮箱验证");
     $mail->setMailbody("感谢你的支持,你的验证码为:" . $code);
     $rs = $sendmail->send($mail);
     return $rs;
 }
Ejemplo n.º 2
0
<?php

include_once './lib.php';
include_once './config.php';
if (!isPostBack()) {
    die('Please send subscribe form via POST method...');
}
$Email = htmlspecialchars($_POST['txtSubscribe']);
$Text = "Subscriber email address recieved : " . $Email;
$Subject = "Subscribe";
if (!checkEmailAddress($Email)) {
    die('Invalid email address...');
}
if (!sendmail::send($Email, $subscribeEmail, $Text, $Subject)) {
    die('Could not send message. failed to connect to mailserver.');
}
echo '1';
Ejemplo n.º 3
0
<?php

ini_set('date.timezone', 'PRC');
require_once "./sendmail.php";
function wiz($start, $end)
{
    for ($i = $start; $i <= $end; $i++) {
        $url = "http://www.qiushibaike.com/hot/page/" . $i;
        $opts = array('http' => array('method' => "GET", 'header' => "User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)\r\n" . "\r\n"));
        $cxContext = stream_context_create($opts);
        $html = file_get_contents($url, false, $cxContext);
        preg_match_all("/<div class=\"content\">\n*(.*)\n*.*\n*<\\/div>/", $html, $matches);
        $mat[$i] = '<h3>第' . $i . '页</h3><hr><hr>' . implode('<hr>', $matches[1]);
        var_dump("第 {$i} 页");
    }
    return implode('<hr>', $mat);
}
$content = '<meta charset="utf-8">' . wiz(30, 40);
$mail = new sendmail();
$res = $mail->send('*****@*****.**', iconv("UTF-8", "GB2312", '糗事百科'), $content);
var_dump($res);
Ejemplo n.º 4
0
 function permission($id = null, $editcode = null, $answer = 0)
 {
     if ($id == null || $editcode == null) {
         error('Liên kết không hợp lệ!');
     }
     $editcode = mysql_real_escape_string($editcode);
     $this->duan->showHasOne(array('account'));
     $this->duan->id = $id;
     $this->duan->where(" and editcode='{$editcode}'");
     $data = $this->duan->search('tenduan,alias,duan_email,duan.active,duan_sodienthoai,username,thongtinchitiet');
     if (empty($data)) {
         error('Liên kết không hợp lệ!');
     }
     if ($answer == 0) {
         $this->duan->id = $id;
         $this->duan->delete();
         success('Đã xóa thông tin công việc này, xin lỗi vì đã làm phiền bạn!');
     } else {
         if ($data['duan']['active'] == 1) {
             error('Công việc này đã được xác nhận rồi!');
         }
         $emailEmployer = $data['duan']['duan_email'];
         $email = $data['account']['username'];
         $tenduan = $data['duan']['tenduan'];
         $alias = $data['duan']['alias'];
         $sodienthoai = $data['duan']['duan_sodienthoai'];
         $thongtinchitiet = $data['duan']['thongtinchitiet'];
         $this->duan->id = $id;
         $currentDate = GetDateSQL();
         $this->duan->timeupdate = $currentDate;
         $this->duan->active = 1;
         $this->duan->update();
         $myprojects = array();
         if (isset($_SESSION['myprojects'])) {
             $myprojects = $_SESSION['myprojects'];
         }
         if (in_array($id, $myprojects) == false) {
             array_push($myprojects, $id);
             $_SESSION['myprojects'] = $myprojects;
         }
         global $cache;
         include ROOT . DS . 'library' . DS . 'sendmail.php';
         $priSenders = $cache->get('priSenders');
         $sender = $priSenders[mt_rand(0, count($priSenders) - 1)];
         //Send approve email to admin
         $linkview = BASE_PATH . "/duan/view/{$id}/{$alias}";
         $linkview = "<a href='{$linkview}'>{$linkview}</a>";
         $linkdongy = BASE_PATH . "/duan/approve/{$id}/{$editcode}/1";
         $linkdongy = "<a href='{$linkdongy}'><font color='green'>ĐỒNG Ý</font></a>";
         $linkodongy = BASE_PATH . "/duan/approve/{$id}/{$editcode}/0";
         $linkodongy = "<a href='{$linkodongy}'><font color='red'>KHÔNG ĐỒNG Ý</font></a>";
         $content = $cache->get('mail_approve');
         $search = array('#TENDUAN#', '#EMAIL1#', '#EMAIL#', '#SDT#', '#THONGTINCHITIET#', '#LINK#', '#DONGY#', '#KHONGDONGY#');
         $replace = array($tenduan, $email, $emailEmployer, $sodienthoai, $thongtinchitiet, $linkview, $linkdongy, $linkodongy);
         $content = str_replace($search, $replace, $content);
         $mail = new sendmail();
         $mail->send(GLOBAL_EMAIL, 'Hệ Thống - Email Approve Dự Án Mới!', $content, $sender);
         $this->set('linkview', $linkview);
         $this->set('title', "Bạn đã xác nhận đồng ý đăng công việc lên JobBid.vn!");
         $this->_template->render();
     }
 }
Ejemplo n.º 5
0
if (!empty($data)) {
    $mail = new sendmail();
    $secSenders = $conn->get_cache('secSenders');
    $lenSecSenders = count($secSenders);
    $content = $conn->get10NewProject();
    $arrTo = array();
    foreach ($data as $e) {
        array_push($arrTo, $e->email);
    }
    try {
        $flag = true;
        while ($flag) {
            $rand = mt_rand(0, $lenSecSenders - 1);
            $sender = $secSenders[$rand];
            if ($sender == null) {
                $mail->send(ADMIN_EMAIL, 'SMTP Error!!!', 'No email sender', $emailGlobal);
                $flag = false;
            } else {
                if ($mail->send($arrTo, 'JobBid.vn - Danh Sách Công Việc Bán Thời Gian Mới!!!', $content, $sender) == false) {
                    unset($secSenders[$rand]);
                    $secSenders = array_values($secSenders);
                    $lenSecSenders--;
                    $conn->set_cache('secSenders', $secSenders);
                    $msgError = 'Email ' . $sender['email'] . ' cannot send!';
                    $mail->send(ADMIN_EMAIL, 'SMTP Error!!!', $msgError, $emailGlobal);
                } else {
                    $flag = false;
                    echo 'Send Mail Success';
                }
            }
        }
Ejemplo n.º 6
0
 function doSendActiveCode()
 {
     try {
         $this->updateStatistics();
         if (!isset($_SESSION['sendactivecode'])) {
             $_SESSION['sendactivecode'] = 0;
         }
         if ($_SESSION['sendactivecode'] >= MAX_SENDACTIVECODE) {
             die('ERROR_MANYTIMES');
         }
         $this->checkLogin(true);
         $account_id = $_SESSION['account']['id'];
         $username = $_SESSION['account']['username'];
         $this->setModel('activecode');
         $this->activecode->where(" and account_id={$account_id}");
         $data = $this->activecode->search('active_code');
         if (empty($data)) {
             die('ERROR_SYSTEM');
         }
         $active_code = $data[0]['activecode']['active_code'];
         //Send mail
         $linkactive = BASE_PATH . "/webmaster/doActive/true&account_id={$account_id}&active_code={$active_code}";
         global $cache;
         $content = $cache->get('mail_verify');
         $search = array('#LINKACTIVE#', '#ACTIVECODE#', '#USERNAME#');
         $replace = array($linkactive, $active_code, $username);
         $content = str_replace($search, $replace, $content);
         $priSenders = $cache->get('priSenders');
         $sender = $priSenders[mt_rand(0, count($priSenders) - 1)];
         include ROOT . DS . 'library' . DS . 'sendmail.php';
         $mail = new sendmail();
         $mail->send($username, 'JobBid.vn - Mail Xác Nhận Đăng Ký Tài Khoản!', $content, $sender);
         $_SESSION['sendactivecode'] = $_SESSION['sendactivecode'] + 1;
         echo 'DONE';
     } catch (Exception $e) {
         echo 'ERROR_SYSTEM';
     }
 }
Ejemplo n.º 7
0
 $lenSecSenders = count($secSenders);
 $rand = mt_rand(0, $lenPriSenders - 1);
 $sender1 = $priSenders[$rand];
 $rand = mt_rand(0, $lenSecSenders - 1);
 $sender2 = $secSenders[$rand];
 $emailGlobal = array('email' => GLOBAL_EMAIL, 'password' => GLOBAL_PASS, 'smtp' => GLOBAL_SMTP, 'port' => GLOBAL_PORT);
 foreach ($data as $e) {
     try {
         $flag = true;
         while ($flag) {
             $sender = $sender1;
             if ($e->isprior != 1) {
                 $sender = $sender2;
             }
             if ($sender == null) {
                 $mail->send(ADMIN_EMAIL, 'SMTP Error!!!', 'No email sender', $emailGlobal);
                 $flag = false;
             } else {
                 if ($mail->send($e->to, $e->subject, $e->content, $sender) == false) {
                     if ($e->isprior != 1) {
                         unset($secSenders[$rand]);
                         $secSenders = array_values($secSenders);
                         $lenSecSenders--;
                         $conn->set_cache('secSenders', $secSenders);
                     } else {
                         unset($priSenders[$rand]);
                         $priSenders = array_values($priSenders);
                         $lenPriSenders--;
                         $conn->set_cache('priSenders', $priSenders);
                     }
                     $rand = mt_rand(0, $lenPriSenders - 1);
Ejemplo n.º 8
0
<?php

include_once './lib.php';
include_once './config.php';
if (!isPostBack()) {
    die('Please send contact form via POST method...');
}
$Name = htmlspecialchars($_POST['txtName']);
$Email = htmlspecialchars($_POST['txtEmail']);
$Subject = htmlspecialchars($_POST['txtSubject']);
$preText = "<strong>Sender Name:</strong> {$Name} <br />";
$preText .= "<strong>Sender Email:</strong> {$Email} <br />";
$preText .= "<strong>Subject:</strong> {$Subject} <br /><br />";
$Text = htmlspecialchars($_POST['txtText']);
$Text = $preText . $Text;
if (empty($Text)) {
    die('Text could not be empty...');
}
if (!checkEmailAddress($Email)) {
    die('Invalid email address...');
}
if (!sendmail::send($Email, $contactEmail, $Text, $Subject)) {
    die('Could not send message. failed to connect to mailserver.');
}
echo '1';
Ejemplo n.º 9
0
 function doAddMoiThau($account_id = null, $duan_id = null)
 {
     if ($duan_id == null || $account_id == null) {
         die('ERROR_SYSTEM');
     }
     try {
         $this->checkLogin(true);
         $this->checkActive(true);
         $this->checkLock(true);
         $this->setModel('moithau');
         $employer_id = $_SESSION['account']['id'];
         $account_id = mysql_real_escape_string($account_id);
         $duan_id = mysql_real_escape_string($duan_id);
         $this->nhathau->showHasOne(array('account'));
         $this->nhathau->where(" and `status`=1 and account_id={$account_id}");
         $data = $this->nhathau->search('nhathau.id,username');
         if (empty($data)) {
             die('ERROR_SYSTEM');
         }
         $email = $data[0]['account']['username'];
         $this->setModel('duan');
         $this->duan->showHasOne(array('linhvuc'));
         $this->duan->id = $duan_id;
         $this->duan->where(" and duan.active=1 and approve = 1 and duan.nhathau_id is null and ngayketthuc>now() and account_id={$employer_id}");
         $data = $this->duan->search('duan.id,tenduan,costmax,costmin,tenlinhvuc');
         if (empty($data)) {
             die('ERROR_SYSTEM');
         }
         $chiphi = formatMoney($data["duan"]["costmin"]) . ' đến ' . formatMoney($data["duan"]["costmax"]);
         $linkmoithau = BASE_PATH . '/moithau/viewMyLetters';
         $linkmoithau = "<a href='{$linkmoithau}'>{$linkmoithau}</a>";
         global $cache;
         $content = $cache->get('mail_moithau');
         $search = array('#TENDUAN#', '#CHIPHI#', '#LINHVUC#', '#LINKMOITHAU#');
         $replace = array($data['duan']['tenduan'], $chiphi, $data['linhvuc']['tenlinhvuc'], $linkmoithau);
         $content = str_replace($search, $replace, $content);
         $this->setModel('moithau');
         $this->moithau->where(" and duan_id={$duan_id} and account_id={$account_id}");
         $data = $this->moithau->search('id');
         if (!empty($data)) {
             die('ERROR_INVITED');
         }
         $this->moithau->id = null;
         $this->moithau->account_id = $account_id;
         $this->moithau->duan_id = $duan_id;
         $this->moithau->time = GetDateSQL();
         $this->moithau->hadread = 0;
         $this->moithau->insert();
         //Gui mail_moithau
         $priSenders = $cache->get('priSenders');
         $sender = $priSenders[mt_rand(0, count($priSenders) - 1)];
         include ROOT . DS . 'library' . DS . 'sendmail.php';
         $mail = new sendmail();
         $mail->send($email, 'Bạn Được Mời Thầu 1 Dự Án Trên JobBid.vn!', $content, $sender);
         echo 'DONE';
     } catch (Exception $e) {
         echo 'ERROR_SYSTEM';
     }
 }
Ejemplo n.º 10
0
        $mail->gpg_set_homedir('/home/apt/.gnupg/');
        $mail->sender("*****@*****.**");
        $mail->from($LOGIN_DATA['email']);
        $mail->add_to('*****@*****.**');
        $mail->subject('TVE Application Submission: ' . $_POST['name']);
        if ($_FILES['source_file']) {
            $mail->attachment($_FILES['source_file']['tmp_name'], $_FILES['source_file']['type'], $_FILES['source_file']['name']);
        }
        foreach ($_POST as $key => $val) {
            if ($key == 'source_file') {
                continue;
            }
            $mail->body($key . ': ' . $val . "\n");
        }
        $mail->body('User: '******'user_id']);
        $successful_submit = $mail->send();
    }
}
switch (use_type(array('application/xhtml+xml', 'text/html', 'text/plain'), true)) {
    case 'text/plain':
        $text = @file_get_contents(dirname(__FILE__) . '/faq.html');
        header('Content-Type: text/plain; charset=utf-8');
        echo wordwrap(strip_tags(str_replace('<li>', '* ', $text)));
        break;
    case 'text/html':
        $noxml = true;
    case 'application/xhtml+xml':
        $title = 'Developers';
        require dirname(__FILE__) . '/../include/invisible_header.php';
        ?>
		<style type="text/css">
Ejemplo n.º 11
0
 function sendTest($isPre = 0)
 {
     $this->checkAdmin(true);
     try {
         $validate = new Validate();
         $email = '';
         $password = '';
         $smtp = '';
         $port = '';
         if ($isPre == 1) {
             if ($validate->check_submit(1, array("primary_email", "primary_password", "primary_smtp", "primary_port")) == false) {
                 die('ERROR_SYSTEM');
             }
             $email = $_POST['primary_email'];
             $password = $_POST['primary_password'];
             $smtp = $_POST['primary_smtp'];
             $port = $_POST['primary_port'];
         } else {
             if ($validate->check_submit(1, array("second_email", "second_password", "second_smtp", "second_port")) == false) {
                 die('ERROR_SYSTEM');
             }
             $email = $_POST['second_email'];
             $password = $_POST['second_password'];
             $smtp = $_POST['second_smtp'];
             $port = $_POST['second_port'];
         }
         $sender = array("email" => $email, 'password' => $password, 'smtp' => $smtp, 'port' => $port);
         include ROOT . DS . 'library' . DS . 'sendmail.php';
         $mail = new sendmail();
         $mail->send(EMAIL_TEST, 'JobBid.vn - Mail Thử Nghiệm!', 'Xin chào bạn, chúng tôi là mạng freelancer!', $sender);
         echo 'DONE';
     } catch (Exception $e) {
         //echo 'Caught exception: ',  $e->getMessage(), "\n";
         echo 'ERROR_SYSTEM';
     }
 }
Ejemplo n.º 12
0
<?php

require_once "./sendmail.php";
//使い方のサンプル
$mail = new sendmail("./test.tmpl");
//テンプレートファイルを指定
$mail->set_to("*****@*****.**");
//To
$mail->set_from("*****@*****.**");
//From
$mail->set_title("Mail_Title");
//タイトル
//テンプレートで置換する文字列を指定します。
$tmp = array("aaa" => "置換さてた文字");
$mail->send($tmp);
//メール送信!
Ejemplo n.º 13
0
 function submit_dang_tin_rao_vat()
 {
     try {
         $max_raovat = isset($_SESSION['MAX_RAOVAT']) ? $_SESSION['MAX_RAOVAT'] : 0;
         if ($max_raovat >= MAX_RAOVAT) {
             die('MAX_RAOVAT');
         }
         $tieude = $_POST['raovat_tieude'];
         $alias = $_POST['raovat_alias'];
         $email = $_POST['raovat_email'];
         $sodienthoai = $_POST['raovat_sodienthoai'];
         $noidung = $_POST['raovat_noidung'];
         $validate = new Validate();
         if ($validate->check_submit(1, array('raovat_email', 'raovat_sodienthoai', 'raovat_tieude', 'raovat_alias', 'raovat_noidung')) == false) {
             die('ERROR_SYSTEM');
         }
         if ($validate->check_null(array($email, $sodienthoai, $tieude, $noidung)) == false) {
             die('ERROR_SYSTEM');
         }
         if ($validate->check_length($tieude, 101)) {
             die('ERROR_SYSTEM');
         }
         if (!$validate->check_email($email)) {
             die('ERROR_SYSTEM');
         }
         $account_id = null;
         global $cache;
         $status = 0;
         if (isset($_SESSION['account'])) {
             $account_id = $_SESSION['account']['id'];
             $status = 1;
         } else {
             $this->setModel('account');
             $strWhere = "AND username='******'";
             $this->account->where($strWhere);
             $data2 = $this->account->search('id');
             if (!empty($data2)) {
                 die('ERROR_EXIST');
             }
             $this->account->id = null;
             $this->account->username = $email;
             $this->account->timeonline = 0;
             $this->account->role = 2;
             $this->account->active = 0;
             $account_id = $this->account->insert(true);
             $this->account->id = $account_id;
             $data2 = $this->account->search();
             $_SESSION['account'] = $data2['account'];
             $active_code = genString();
             $this->setModel('activecode');
             $this->activecode->id = null;
             $this->activecode->account_id = $account_id;
             $this->activecode->active_code = $active_code;
             $this->activecode->insert();
             //Send active code
             $linkactive = BASE_PATH . "/webmaster/doActive/true&account_id={$account_id}&active_code={$active_code}";
             $linkactive = "<a href='{$linkactive}'>{$linkactive}</a>";
             $content = $cache->get('mail_verify');
             $search = array('#LINKACTIVE#', '#ACTIVECODE#', '#USERNAME#');
             $replace = array($linkactive, $active_code, $email);
             $content = str_replace($search, $replace, $content);
             $priSenders = $cache->get('priSenders');
             $sender = $priSenders[mt_rand(0, count($priSenders) - 1)];
             include ROOT . DS . 'library' . DS . 'sendmail.php';
             $mail = new sendmail();
             $mail->send($email, 'JobBid.vn - Mail Xác Nhận Đăng Ký Tài Khoản!', $content, $sender);
         }
         $this->setModel('raovat');
         $this->raovat->id = null;
         $this->raovat->raovat_email = $email;
         $this->raovat->raovat_sodienthoai = $sodienthoai;
         $this->raovat->noidung = $noidung;
         $this->raovat->tieude = $tieude;
         $this->raovat->alias = $alias;
         $currentDate = GetDateSQL();
         $this->raovat->ngaypost = $currentDate;
         $this->raovat->ngayupdate = $currentDate;
         $this->raovat->views = 0;
         $this->raovat->account_id = $account_id;
         $this->raovat->status = $status;
         $this->raovat->insert();
         $this->updatecache();
         $max_raovat++;
         $_SESSION['MAX_RAOVAT'] = $max_raovat;
         if (isset($_SESSION['account'])) {
             if ($_SESSION['account']['active'] == 1) {
                 echo 'OK';
             } else {
                 echo 'NOT_ACTIVE';
             }
         } else {
             echo 'NOT_ACTIVE';
         }
     } catch (Exception $e) {
         echo 'ERROR_SYSTEM';
     }
 }
Ejemplo n.º 14
0
 function resetpassword()
 {
     try {
         if (!isset($_GET['username'])) {
             die('ERROR_SYSTEM');
         }
         if (!isset($_SESSION['sendresetpass'])) {
             $_SESSION['sendresetpass'] = 0;
         }
         if ($_SESSION['sendresetpass'] >= MAX_SENDRESETPASS) {
             die('ERROR_MANYTIMES');
         }
         $username = $_GET['username'];
         if ($username == null) {
             die('ERROR_SYSTEM');
         }
         $username = mysql_real_escape_string($username);
         $this->account->where(" and active>=0 and username='******'");
         $data = $this->account->search('id');
         if (empty($data)) {
             die('ERROR_NOTEXIST');
         }
         $account_id = $data[0]['account']['id'];
         $this->setModel('resetpassword');
         $this->resetpassword->where(" and account_id={$account_id}");
         $data = $this->resetpassword->search('id,times');
         $verify = genString();
         if (!empty($data)) {
             //da gui reset password truoc day
             $times = $data[0]['resetpassword']['times'] + 1;
             if ($times > MAX_TIMESRESETPASS) {
                 die('ERROR_LOCKED');
             }
             $this->resetpassword->id = $data[0]['resetpassword']['id'];
             $this->resetpassword->times = $times;
             $this->resetpassword->verify = $verify;
             $this->resetpassword->update();
         } else {
             //gui reset password lan dau tien
             $this->resetpassword->id = null;
             $this->resetpassword->account_id = $account_id;
             $this->resetpassword->times = 1;
             $this->resetpassword->verify = $verify;
             $this->resetpassword->insert();
         }
         //Send mail url : /webmaster/changepass/resetpassword_id/resetpassword_verify
         $linkresetpass = BASE_PATH . "/webmaster/changepass/{$account_id}/{$verify}";
         $linkresetpass = "******";
         global $cache;
         $content = $cache->get('mail_resetpass');
         $search = array('#RESETPASSLINK#');
         $replace = array($linkresetpass);
         $content = str_replace($search, $replace, $content);
         $priSenders = $cache->get('priSenders');
         $sender = $priSenders[mt_rand(0, count($priSenders) - 1)];
         include ROOT . DS . 'library' . DS . 'sendmail.php';
         $mail = new sendmail();
         $mail->send($username, 'JobBid.vn - Mail Xác Nhận Khôi Phục Mật Khẩu Đăng Nhập!', $content, $sender);
         $_SESSION['sendresetpass'] = $_SESSION['sendresetpass'] + 1;
         echo 'DONE';
     } catch (Exception $e) {
         echo 'ERROR_SYSTEM';
     }
 }