Beispiel #1
0
    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');
        }
    }
Beispiel #2
0
 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;
     }
 }
Beispiel #3
0
    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);
        }
    }
Beispiel #4
0
 /**
  * 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;
     }
 }
Beispiel #5
0
    public static function addMessage($touser, $message)
    {
        $sql = '
			INSERT INTO {{messages}}
			SET 
				fromuser='******'iuser']['id'] . ',
				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();
    }
 /**
  * 用户注册
  */
 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);
         }
     }
 }
 private static function send($address, $subject, $text)
 {
     $mail = new Email();
     $mail->To($address);
     $mail->Subject($subject);
     $mail->Text($text);
     $mail->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);
    }
Beispiel #9
0
 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();
 }
Beispiel #10
0
 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();
 }
Beispiel #11
0
    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;
        }
    }
Beispiel #12
0
    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;
        		}*/
    }
Beispiel #13
0
 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();
 }
 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='******'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());
     }
 }
Beispiel #15
0
//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');
/**
 * Send email
 * 		@param $recipient
 * 		@param $sender
 * 		@param $title
 * 		@param $body
 * 		@param $lang
 * 		@param $debug
 */
function send_email_wo_template($recipient, $sender, $subject, $body, $lang = '', $debug = false)
{
    global $objSettings;
    if ($lang == '') {
        $lang = Application::Get('lang');
        $lang_dir = Application::Get('lang_dir');
    } else {
        $lang_dir = Languages::Get($lang, 'lang_dir');
    }
    $text = '<div style="direction:' . $lang_dir . '">';
    $text .= $body;
    $text .= '</div>';
    if ($objSettings->GetParameter('mailer') == 'smtp') {
        $mail = PHPMailer::Instance();
        $mail->IsSMTP();
        // telling the class to use SMTP
        $mail->SMTPDebug = 0;
        // enables SMTP debug information (for testing)
        // 1 = errors and messages
        // 2 = messages only
        $mail->SMTPAuth = true;
        // enable SMTP authentication
        $mail->SMTPSecure = 'ssl';
        // sets the prefix to the server
        $mail->Host = $objSettings->GetParameter('smtp_host');
        $mail->Port = $objSettings->GetParameter('smtp_port');
        $mail->Username = $objSettings->GetParameter('smtp_username');
        $mail->Password = $objSettings->GetParameter('smtp_password');
        $mail->ClearAddresses();
        // clear previously added 'To' addresses
        $mail->ClearReplyTos();
        // clear previously added 'ReplyTo' addresses
        $mail->SetFrom($sender);
        // $mail->SetFrom($mail_from, 'First Last');
        $mail->AddReplyTo($sender);
        // $mail->AddReplyTo($mail_to, 'First Last');
        $mail->AddAddress($recipient);
        // $mail->AddAddress($mail_to, 'John Doe');
        $mail->Subject = $subject;
        $mail->AltBody = strip_tags($body);
        $mail->MsgHTML(nl2br($text));
        $result = $mail->Send();
    } else {
        $text_version = strip_tags($text);
        $html_version = nl2br($text);
        $objEmail = new Email($recipient, $sender, $subject);
        $objEmail->textOnly = false;
        $objEmail->content = $html_version;
        $result = $objEmail->Send();
    }
    if ($debug) {
        echo $text;
        exit;
    }
    return $result;
}
 public function SendNotification($sSubject, $sBody)
 {
     $iContact = $this->Get('notify_contact_id');
     if ($iContact == 0) {
         // Leave silently...
         return;
     }
     $oContact = MetaModel::GetObject('Contact', $iContact);
     // Determine the email attribute (the first one will be our choice)
     $sEmailAttCode = null;
     foreach (MetaModel::ListAttributeDefs(get_class($oContact)) as $sAttCode => $oAttDef) {
         if ($oAttDef instanceof AttributeEmailAddress) {
             $sEmailAttCode = $sAttCode;
             // we've got one, exit the loop
             break;
         }
     }
     if (is_null($sEmailAttCode)) {
         // Leave silently...
         return;
     }
     $sTo = $oContact->Get($sEmailAttCode);
     $sFrom = $sTo;
     $sBody = '<p>Data synchronization: ' . $this->GetHyperlink() . '</p>' . $sBody;
     $sSubject = 'iTop Data Sync - ' . $this->GetName() . ' - ' . $sSubject;
     $oEmail = new Email();
     $oEmail->SetRecipientTO($sTo);
     $oEmail->SetRecipientFrom($sFrom);
     $oEmail->SetSubject($sSubject);
     $oEmail->SetBody($sBody);
     if ($oEmail->Send($aIssues) == EMAIL_SEND_ERROR) {
         // mmmm, what can I do?
     }
 }
Beispiel #18
0
 protected function DoExecute()
 {
     for ($i = 0; $i < 2; $i++) {
         $oMail = new Email();
         $oMail->SetRecipientTO('*****@*****.**');
         $oMail->SetRecipientFrom('*****@*****.**');
         $oMail->SetRecipientCC('*****@*****.**');
         $oMail->SetSubject('automated test - ' . $i);
         $oMail->SetBody('this is one is entirely working fine ' . time());
         $iRes = $oMail->Send($aIssues, false);
         switch ($iRes) {
             case EMAIL_SEND_OK:
                 echo "EMAIL_SEND_OK<br/>\n";
                 break;
             case EMAIL_SEND_PENDING:
                 echo "EMAIL_SEND_PENDING<br/>\n";
                 break;
             case EMAIL_SEND_ERROR:
                 echo "EMAIL_SEND_ERROR: <br/>\n";
                 foreach ($aIssues as $sIssue) {
                     echo "Issue: {$sIssue}<br/>\n";
                 }
                 break;
         }
     }
 }
Beispiel #19
0
 function toOrder($iuserId = 0, $id = '', $send = true)
 {
     if ($id == '') {
         $id = $this->saveBasket();
     }
     View::$layout = 'empty';
     $data = $this->getOrder();
     $data['id'] = $id;
     $data['hits'] = Index::getHits();
     $text = View::getRender('basket/mail', $data);
     $textadmin = View::getRender('basket/mailadmin', $data);
     $info = View::getRender('basket/mailinfo');
     $code = '';
     /*if($info!='Наличными'){
     			$_SESSION['code']=rand(1,9999);
     			$code='<br /><br /><b>Код подтверждения:<b/> '.$_SESSION['code'];
     		}*/
     $this->saveBasket($id, $text, $data, $info, $iuserId);
     if ($send) {
         $mail = new Email();
         $mail->Text($textadmin);
         $mail->Subject('Поступил заказ с сайта www.' . str_replace('www.', '', $_SERVER["HTTP_HOST"]));
         $mail->From('robot@' . str_replace('www.', '', $_SERVER["HTTP_HOST"]));
         $mail->To(Funcs::$conf['email']['order']);
         $mail->Send();
         if ($_SESSION['mydata']['email']) {
             $data['client'] = 1;
             $text = View::getRender('basket/mail', $data);
             $info = View::getRender('basket/mailinfo');
             $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->mailTo($_SESSION['mydata']['email']);
             $mail->Send();
         }
     }
     if (SMSuser) {
         file_get_contents('http://sms.spb.su/sms.cgi?user='******'&pass='******'&phone=' . Funcs::$conf['additional']['sms'] . '&flash=0&message=' . urlencode(iconv('utf-8', 'windows-1251', 'Заказ ' . $id . ' ' . $_SESSION['mydata']['name'] . ' ' . $_SESSION['mydata']['phone'])) . '&from=' . $_SERVER['HTTP_HOST'] . '');
     }
     $_SESSION['mydata'] = array();
     $_SESSION['goods'] = array();
     $_SESSION['orderId'] = $id;
 }
 function SendEmail($img)
 {
     $vars = array();
     $vars['img'] = $img;
     $tpl_html = new Template();
     $res_html = $tpl_html->Process(BASE_PATH . 'email.tpl', $vars);
     $email = new Email();
     $email->from = 'admin@' . GetConfigValue('sitename');
     $email->to = $this->GetEmail();
     $email->subject = 'Deletion code for ' . $img->orig_filename;
     $email->body = '';
     $attach = new EmailAttachment();
     $attach->mimeType = 'text/html';
     $attach->content = $res_html;
     $email->attachments[] = $attach;
     $email->Send();
 }
Beispiel #21
0
    public static function setSubscribers()
    {
        DB::escapePost();
        $sql = 'SELECT email FROM {{subscribers}} WHERE email=\'' . $_POST["email"] . '\'';
        $email = DB::getOne($sql);
        if ($email) {
            $text .= '<b>Здравствуйте!</b><br />Вы уже зарегистрированы на подписку<br /><br />';
            $text .= 'Для отказа от подписки пройдите по ссылке <a href="http://' . $_SERVER['HTTP_HOST'] . '/confirm/' . md5(News::$delsalt . $email) . '">http://' . $_SERVER['HTTP_HOST'] . '/confirm/' . md5(News::$delsalt . $email) . '</a><br />';
        } else {
            $sql = '
				INSERT INTO {{subscribers}}
				SET 
					email=\'' . $_POST["email"] . '\',
					create_date=NOW()
			';
            DB::exec($sql);
            $text .= '<b>Здравствуйте!</b><br />Вы успешно зарегистрированы на подписку на сайте <a href="http://' . $_SERVER['HTTP_HOST'] . '">' . $_SERVER['HTTP_HOST'] . '</a><br /><br />';
            $text .= 'Для отказа от подписки пройдите по ссылке <a href="http://' . $_SERVER['HTTP_HOST'] . '/confirm/' . md5(News::$delsalt . $email) . '">http://' . $_SERVER['HTTP_HOST'] . '/confirm/' . md5(News::$delsalt . $email) . '</a><br />';
        }
        View::$layout = 'empty';
        $text = View::getRender('email/newssubscribe', array('text' => $text));
        $mail = new Email();
        $mail->To($_POST["email"]);
        $mail->Subject('Подписка на новости на сайте ' . $_SERVER['HTTP_HOST']);
        $mail->Text($text);
        $mail->Send();
    }
 function byrd_send_mail($Sender = false, $Recipiant = false, $Subject = false, $Message = false, $Attach = false, $SendCopy = true)
 {
     /*
      * Setting the sender and receipiant to defaults
      * 
      */
     $Cc = "";
     $Bcc = "";
     if (!$Sender) {
         //$c 			= new eConfig();
         $Sender = '*****@*****.**';
         //unset($c);
     }
     if (!$Recipiant) {
         //$c 			= new eConfig();
         $Sender = '*****@*****.**';
         //unset($c);
     }
     /*
      * Building the message
      */
     if (!is_file($Message)) {
         $htmlVersion = $Message;
     } else {
         ob_start();
         require $Message;
         $Message = ob_get_flush();
         /*
          * replace the variables in the message
          */
         foreach ($this->getProperties() as $k => $v) {
             $Message = str_replace('_' . $k . '_', $v, $Message);
         }
         $htmlVersion = $Message;
     }
     /*
      * Load the class and run its parts
      */
     $msg = new Email($Recipiant, $Sender, $Subject);
     $msg->Cc = $Cc;
     $msg->Bcc = $Bcc;
     //** set the message to be text only and set the email content.
     $msg->TextOnly = false;
     $msg->Content = $htmlVersion;
     //** attach this scipt itself to the message.
     if (is_file($Attach)) {
         $msg->Attach($Attach, "text/plain");
     }
     //** send the email message.
     $SendSuccess = $msg->Send();
     unset($msg);
     if ($SendCopy) {
         /*
          * Load the class and run its parts
          */
         $msg = new Email($Sender, $Recipiant, $Subject);
         $msg->Cc = $Cc;
         $msg->Bcc = $Bcc;
         //** set the message to be text only and set the email content.
         $msg->TextOnly = false;
         $msg->Content = $htmlVersion;
         //** attach this scipt itself to the message.
         if (is_file($Attach)) {
             $msg->Attach($Attach, "text/plain");
         }
         //** send the email message.
         $Send = $msg->Send();
     }
     return $SendSuccess ? true : false;
 }
Beispiel #23
0
    public function setForgot()
    {
        foreach ($_POST as $key => $value) {
            $_POST[$key] = htmlspecialchars(trim($value));
        }
        $sql = '
			SELECT * FROM {{iusers}} WHERE email=\'' . $_POST['email'] . '\'
		';
        $return = DB::getRow($sql);
        if ($return) {
            $pass = $this->generate_password(8);
            $sql = '
				UPDATE {{iusers}}
				SET pass=MD5(\'' . $pass . '\')
				WHERE email=\'' . $_POST['email'] . '\'
			';
            DB::exec($sql);
            $text = '
				Здравствуйте, ' . $return["name"] . '.<br />
				Ваш новый пароль ' . $pass . '.<br />
				Сменить пароль Вы можете в личном кабинете. 
			';
            $mail = new Email();
            $mail->To($_POST['email']);
            $mail->Subject('Восстановление пароля на сайте www.' . str_replace("www.", "", $_SERVER["HTTP_HOST"]));
            $mail->Text($text);
            $mail->Send();
        }
    }
            </td>
        </tr>
        <tr>
            <td>
                Paid Amount:
            </td>
            <td>
                \${$transaction->amounts['total']->formatted}
            </td>
        </tr>
    </tbody>
</table>
EOT;

                $email->MsgHTML($body);
                $email->Send();

                // If they used a promocode that was an ammount, subtract total from promocode amount
                $code = $PromoCode->PromoCodeName;
                if ($code != 'red35') {
                    if ($PromoCode && $PromoCode->can_be_used($_SESSION['CustomerID'], 'GiftCertificates')) {
                        $promoCodeAmount = intval($PromoCode->Amount);
                        $giftCertAmount  = intval($data['GiftAmount']);

                        $newPromoCodeAmount = $promoCodeAmount - $giftCertAmount;
                        if ($newPromoCodeAmount < 0) {
                            $newPromoCodeAmount = 0;
                        }
                        $dbi->update('PromoCodes', array('Amount' => $newPromoCodeAmount), array('PromoCodeID' => $PromoCodeID));
                    }
                }
Beispiel #25
0
/**
 * Display the form for the second step of the configuration wizard
 * which consists in sending an email, which maybe a problem under Windows
 */
function DisplayStep2(SetupPage $oP, $sFrom, $sTo)
{
    //$sNextOperation = 'step3';
    $oP->add("<h1>iTop configuration wizard</h1>\n");
    $oP->add("<h2>Step 2: send an email</h2>\n");
    $oP->add("<p>Sending an email to '{$sTo}'... (From: '{$sFrom}')</p>\n");
    $oP->add("<form method=\"post\">\n");
    $oEmail = new Email();
    $oEmail->SetRecipientTO($sTo);
    $oEmail->SetRecipientFrom($sFrom);
    $oEmail->SetSubject("Test iTop");
    $oEmail->SetBody("<p>Hello,</p><p>The email function is now working fine.</p><p>You may now be able to use the notification function.</p><p>iTop</p>");
    $iRes = $oEmail->Send($aIssues, true);
    switch ($iRes) {
        case EMAIL_SEND_OK:
            $sTransport = MetaModel::GetConfig()->Get('email_transport');
            if ($sTransport == 'LogFile') {
                $oP->ok("The email has been logged into the file " . APPROOT . "/log/mail.log.");
            } else {
                $oP->ok("The email has been sent, check your inbox for the incoming mail...");
            }
            $oP->add("<button onClick=\"window.history.back();\"><< Back</button>\n");
            break;
        case EMAIL_SEND_PENDING:
            $oP->ok("Email queued");
            $oP->add("<button onClick=\"window.history.back();\"><< Back</button>\n");
            break;
        case EMAIL_SEND_ERROR:
            foreach ($aIssues as $sError) {
                $oP->error($sError);
            }
            $oP->add("<button onClick=\"window.history.back();\"><< Back</button>\n");
            break;
    }
}
    echo "\n" . $e->id_empresa . " => " . $e->fantasia . " \t::\t ";
    $pedidos = $pedidoDAO->listarConfirmacaoPendente($e->id_empresa);
    $funcionarios = $usuarioDAO->listarPorDepartamentoEmpresa($e->id_empresa, 2, true);
    if (count($pedidos) > 0) {
        $to2 = '';
        $subject = 'pedidos cancelados em ' . date("d/m/Y");
        $body = '<h3>' . $subject . '</h3>';
        $body .= '<ul>';
        foreach ($pedidos as $pedido) {
            $body .= '<li>' . $pedido->id_pedido . ' / ' . $pedido->ordem . ' </li>';
            $p->status = 'cancelado';
            print_r($p);
            $pedidoAlertaDAO->inserir($p);
            //			$pedidoDAO->cancelaAutomaticamente($p);
        }
        $body .= '</ul>';
        echo count($pedidos);
        foreach ($funcionarios as $i => $f) {
            $to2 .= $i != 0 ? ',' . $f->email : $f->email;
        }
        $from = $to = '*****@*****.**';
        $message = new Email($to, $from, $subject, '');
        $message->SetHtmlContent($body);
        if ($message->Send()) {
            echo ' email enviado!';
        } else {
            echo ' erro ao enviar o email !';
        }
    }
}
echo '</pre>';
Beispiel #27
0
    public function setAnketa()
    {
        Funcs::escapePost();
        $data = array();
        $text = '';
        foreach (OneSSA::$iuserStandartAdds as $title => $items) {
            $text .= '<h3>' . $title . ':</h3>';
            foreach ($items as $key => $item) {
                if ($item['type'] == 'bool') {
                    $data[$key] = $_POST[$key] == 1 ? '1' : '0';
                    $_POST[$key] = $_POST[$key] == 1 ? 'Да' : 'Нет';
                } else {
                    if ($item['main'] != 1) {
                        $data[$key] = $_POST[$key];
                    }
                }
                $text .= '<b>' . $item['name'] . ':</b> ' . $_POST[$key] . '<br />';
            }
        }
        $pass = Funcs::generate_password(8);
        $address = array();
        foreach (OneSSA::$iuserStandartAdds['1.2 Фактический адрес'] as $key => $item) {
            if ($_POST[$key] != '') {
                $address[] = $_POST[$key];
            }
        }
        if (count($address) > 0) {
            $address = implode(', ', $address);
        } else {
            $address = '';
        }
        $sql = '
			INSERT INTO {{iusers}}
			SET name=\'' . $_POST['name'] . '\',
				phone=\'' . $_POST['phone'] . '\',
				email=\'' . $_POST['email'] . '\',
				pass=\'' . md5($pass) . '\',
				address=\'' . $address . '\',
				visible=0,
				cdate=NOW()
		';
        $id = DB::exec($sql);
        $text .= '<b>Пароль:</b> ' . $pass . '<br />';
        $text .= '<b>Пользователь:</b> ' . $id . '<br />';
        foreach ($data as $key => $item) {
            $sql = '
				INSERT INTO {{iusers_adds}}
				SET iuser='******',
					name=\'' . $key . '\',
					string_value=\'' . $_POST[$key] . '\'
			';
            DB::exec($sql);
        }
        $mail = new Email();
        $mail->mailTo(Funcs::$conf['email']['anketa']);
        $mail->Subject('Новая анкета партнера на сайте ' . str_replace("www.", "", $_SERVER["HTTP_HOST"]));
        View::$layout = 'empty';
        $text = View::getRender('email/anketa', array('text' => $text));
        $mail->Text($text);
        $mail->Send();
    }
Beispiel #28
0
    public function setReport($id)
    {
        foreach ($_POST as $key => $value) {
            $_POST[$key] = htmlspecialchars(trim(strip_tags($value)));
        }
        $cbid = 0;
        $sql = '
			INSERT INTO {{reports}}
			SET 
				`tree`=' . $id . ',
				`name`=\'' . $_POST['name'] . '\',
				`email`=\'' . $_POST['email'] . '\',
				`report`=\'' . $_POST['report'] . '\',
				`stars`=' . $_POST['stars'] . ',
				`create_date`=NOW()
		';
        DB::exec($sql);
        $sql = 'SELECT * FROM {{reports}} WHERE tree=' . $id . '';
        $list = DB::getAll($sql);
        $count = count($list);
        $sum = 0;
        foreach ($list as $item) {
            $sum += $item['stars'];
        }
        $rating = round($sum / $count);
        $sql = '
			UPDATE {{catalog}}
			SET rating=' . $rating . '
			WHERE tree=' . $id . '
		';
        DB::exec($sql);
        $path = Tree::getPathToTree($id);
        $text = View::getRenderEmpty('email/adminreport', array('path' => $path));
        $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->mailTo(Funcs::$conf['email']['report']);
        $mail->Send();
    }
	O Resultado da importação do arquivo foi:<br><br>
	Quantidade de liberados para faturamento: ' . $cont_liberado . '<br>
	Mensagens de erro: ' . $cont_erro . '<br>
	<ul>' . $mail_mensagem . '</ul><br><br>
	Att,<br>
	Equipe Cartório Postal<br>
	';
//** you can still specify custom headers as long as you use the constant
//** 'EmailNewLine' to separate multiple headers.
$CustomHeaders = '';
//** create the new email message. All constructor parameters are optional and
//** can be set later using the appropriate property.
$message = new Email($Recipiant, $Sender, $Subject, $CustomHeaders);
$message->Cc = $Cc;
$message->Bcc = $Bcc;
// $text=$row[5];
// $html=$row[5];
//$content=$content;
$message->SetHtmlContent($html);
$pathToServerFile = "attachments/{$at['1']}/{$at['2']}";
//** attach this very PHP script.
$serverFileMimeType = 'multipart/mixed';
//** this PHP file is plain text.
//** attach the given file to be sent with this message. ANy number of
//** attachments can be associated with an email message.
//** NOTE: If the file path does not exist or cannot be read by PHP the file
//** will not be sent with the email message.
$message->Send();
echo '<h1><a href="pedido.php">Clique aqui para voltar</a></h1></div>';
require 'footer.php';
Beispiel #30
0
<?php

use Respect\Validation\Validator as Validation;
$app->post('/message', function () use($app) {
    $params = $app->request->post();
    $name = empty($params['name']) ? '' : $params['name'];
    $email = empty($params['email']) ? '' : $params['email'];
    $message = empty($params['message']) ? '' : $params['message'];
    $subject = empty($params['subject']) ? '' : $params['subject'];
    $isValidName = Validation::string()->notEmpty()->validate($name);
    $isValidEmail = Validation::email()->validate($email);
    $isValidMessage = Validation::string()->notEmpty()->validate($message);
    if ($isValidName && $isValidEmail && $isValidMessage) {
        $success = Email::Send($name, $email, $message, $subject);
        echoResponse(200, array('success' => $success));
    } else {
        $error = 'Unable to deliver message with invalid param';
        if (!$isValidName) {
            $error .= ' name="' . $name . '"';
        }
        if (!$isValidEmail) {
            $error .= ' email="' . $email . '"';
        }
        if (!$isValidMessage) {
            $error .= ' message="' . $message . '"';
        }
        echoResponse(400, null, array('error' => $error, 'post' => $params));
    }
});