Exemplo n.º 1
0
function send_email($email, $subject, $template, $ip, $a_origin, $a_dest, $instant_deliver = true)
{
    $errno = can_send_to($email, $ip);
    if ($errno != 0) {
        return $errno;
    }
    $smtpemailto = $email;
    //send to whom
    $subject = $subject;
    //subject
    $content = file_get_contents($template);
    if (count($a_origin) != count($a_dest)) {
        return 4;
    }
    for ($i = 0; $i < count($a_origin); $i++) {
        $content = str_replace($a_origin[$i], $a_dest[$i], $content);
    }
    $smtp = new Smtp(SMTPSERVER, SMTPSERVERPORT, true, SMTPUSER, SMTPPASS);
    //这里面的一个true是表示使用身份验证,否则不使用身份验证.
    $smtp->debug = false;
    //是否显示发送的调试信息
    if ($smtp->sendmail($smtpemailto, SMTPUSERMAIL, $subject, $content, MAILTYPE)) {
        return 0;
    } else {
        return 3;
    }
}
Exemplo n.º 2
0
function enviaEmail($to, $subject, $msg)
{
    /* Configuração da classe.e smtp.class.php */
    $smtp = new Smtp();
    $enviou = $smtp->Send($to, $subject, $msg, "text/html") ? 'enviou' : 'falhou';
    return $enviou;
}
Exemplo n.º 3
0
 public function getServiceConfig()
 {
     return array('factories' => array('Zend\\Authentication\\AuthenticationService' => function ($serviceManager) {
         return $serviceManager->get('doctrine.authenticationservice.orm_default');
     }, 'mail.transport' => function (ServiceManager $serviceManager) {
         $config = $serviceManager->get('Config');
         $transport = new Smtp();
         $transport->setOptions(new SmtpOptions($config['mail']['transport']['options']));
         return $transport;
     }));
 }
Exemplo n.º 4
0
 /**
  * Tests for a successful sending.
  */
 public function testSendOk()
 {
     // Skips the test if no SMTP connection is defined
     if (empty($GLOBALS['smtp'])) {
         $this->markTestSkipped('Smtp host not set');
     }
     $test = new Smtp('Smtp', $GLOBALS['smtp'], '*****@*****.**');
     $result = $test->run();
     $this->assertEquals(\Jyxo\Beholder\Result::SUCCESS, $result->getStatus());
     $this->assertEquals($GLOBALS['smtp'], $result->getDescription());
 }
Exemplo n.º 5
0
 public static function send($email)
 {
     $smtp = new Smtp(SMTP_SERVER, SMTP_PORT, IS_TLS);
     $smtp->auth(SMTP_USER, SMTP_PASSWORD);
     $smtp->mail_from(SMTP_FROM_EMAIL);
     $from = array("FROM" => PIPELINE_NAME);
     $bcc = array("BCC" => $email["bcc"]);
     $addlHeaders = array_merge($from, $bcc);
     $send = $smtp->send($email["to"], $email["subject"], $email["message"], $addlHeaders);
     if (!$send !== true) {
         return $smtp->error(true);
     } else {
         return true;
     }
 }
Exemplo n.º 6
0
 function updateAction()
 {
     $model = new Event();
     // Uncomment the following line if AJAX validation is needed
     $this->performAjaxValidation($model);
     if (isset($_POST['model']) && $_POST['model'] == 'Event') {
         if (isset($_POST['ajax'])) {
             $model->fillFromArray($_POST, FALSE);
             $model->user_id_updated = $this->user->user_id;
             $model->updated = 'NOW():sql';
             $model->model_uset_id = $this->user->user_id;
             if ($model->save()) {
                 Message::echoJsonSuccess(__('events_updated'));
             } else {
                 Message::echoJsonError(__('events_not_updated') . ' ' . $model->errors2string);
             }
             die;
         }
         $model->save();
         $this->redirect();
         die;
     }
     $id = AF::get($this->params, 'id', FALSE);
     if (!$id) {
         throw new AFHttpException(0, 'no_id');
     }
     if (!$model->findByPk($id)) {
         throw new AFHttpException(0, 'incorrect_id');
     }
     $templates = Template::model()->cache()->findAllInArray();
     $smtps = Smtp::model()->cache()->findAllInArray();
     Assets::js('jquery.form');
     $this->addToPageTitle('Update event');
     $this->render('update', array('model' => $model, 'smtps' => $smtps, 'templates' => $templates));
 }
Exemplo n.º 7
0
 public function onSend(Envelope $envelope)
 {
     if (!$envelope->from()) {
         throw new \Exception("[core.email.ses] Amazon SES needs a registered `from` address", 1);
     }
     return Smtp::onSend($envelope);
 }
Exemplo n.º 8
0
 static function sendEmail($subject="",$content="",$to=array()) {
     $emailuser = $info['emailuser'];
     $emailpassword = $info['emailpassword'];
     $smtpserver = C('email_server'); 
     $port = C('email_port');
     $smtpuser = C('email_user');
     $smtppwd = C('email_pwd');
     $mailtype = "TXT";
     $sender = C('email_user');
     $smtp = new Smtp($smtpserver,$port,true,$smtpuser,$smtppwd,$sender);
     $subject = $subject;
     $body = $content;
     $to = implode(",", $to);
     //$body = iconv('UTF-8','gb2312',$fetchcontent);inv
     $send=$smtp->sendmail($to,$sender,$subject,$body,$mailtype);
     
 }
Exemplo n.º 9
0
 private function smtpSend()
 {
     $smtp = new Smtp();
     try {
         $smtp->open($this->hostname, $this->port, $this->timeout);
         $smtp->hello($this->hello);
         $smtp->auth($this->user, $this->pwd);
         $smtp->from($this->from);
         $smtp->to($this->to);
         $smtp->data($this->subject, $this->message);
         $smtp->quit();
         $smtp->close();
     } catch (Exception $e) {
         throw new Exception($e);
     }
 }
Exemplo n.º 10
0
 public function registerAction()
 {
     if ($_POST) {
         $man = new user();
         $data = array('Email' => $this->getRequest()->getParam('Email', ''), 'password' => $this->getRequest()->getParam('password', ''), 'nickname' => $this->getRequest()->getParam('username', ''), 'institute' => $this->getRequest()->getParam('institute', ''), 'grade' => $this->getRequest()->getParam('grade', ''), 'sex' => $this->getRequest()->getParam('sex', ''), 'verify' => md5($this->getRequest()->getParam('username', '') . md5($this->getRequest()->getParam('password', '')) . time()));
         $result = $man->isEmailExist($data['Email']);
         if ($result == true) {
             echo '<script>alert("邮箱已存在,请换个其他的邮箱");window.history.go(-1);</script>';
             exit;
         }
         $result = $man->insertUser($data);
         include_once "smtp.class.php";
         $smtpserver = "smtp.163.com";
         //SMTP服务器
         $smtpserverport = 25;
         //SMTP服务器端口
         $smtpusermail = "*****@*****.**";
         //SMTP服务器的用户邮箱
         $smtpuser = "******";
         //SMTP服务器的用户帐号
         $smtppass = "******";
         //SMTP服务器的用户密码
         $smtp = new Smtp($smtpserver, $smtpserverport, true, $smtpuser, $smtppass);
         //这里面的一个true是表示使用身份验证,否则不使用身份验证.
         $emailtype = "HTML";
         //信件类型,文本:text;网页:HTML
         $smtpemailto = $data['Email'];
         $smtpemailfrom = $smtpusermail;
         $emailsubject = "用户帐号激活";
         $emailbody = "亲爱的" . $data['nickname'] . ":<br/>感谢您在MicrowKnow注册了新帐号。<br/>请点击链接激活您的帐号。<br/><a href='http://localhost/Account/active?verify=" . $data['verify'] . "' target='_blank'>http://localhost/account/active?verify=" . $data['verify'] . "</a><br/>如果以上链接无法点击,请将它复制到你的浏览器地址栏中进入访问,该链接24小时内有效。<br/>如果此次激活请求非你本人所发,请忽略本邮件。<br/><p style='text-align:right'>-------- 武汉大学微软技术俱乐部 敬上</p>";
         $rs = $smtp->sendmail($smtpemailto, $smtpemailfrom, $emailsubject, $emailbody, $emailtype);
         //$this->view->info='恭喜您,注册成功!<br/>请登录到您的邮箱及时激活您的帐号!';
         $this->forward('login', 'index');
     } else {
         $this->render('register');
     }
 }
Exemplo n.º 11
0
function sendmail($time, $email, $url)
{
    include_once "smtp.class.php";
    $smtpserver = "smtp.163.com";
    //SMTP服务器
    $smtpserverport = 25;
    //SMTP服务器端口
    $smtpusermail = "*****@*****.**";
    //SMTP服务器的用户邮箱
    $smtpuser = "******";
    //SMTP服务器的用户帐号
    $smtppass = "";
    //SMTP服务器的用户密码
    $smtp = new Smtp($smtpserver, $smtpserverport, true, $smtpuser, $smtppass);
    //这里面的一个true是表示使用身份验证,否则不使用身份验证.
    $emailtype = "HTML";
    //信件类型,文本:text;网页:HTML
    $smtpemailto = $email;
    $smtpemailfrom = $smtpusermail;
    $emailsubject = "素材火sucaihuo.com - 找回密码";
    $emailbody = "亲爱的" . $email . ":<br/>您在" . $time . "提交了找回密码请求。请点击下面的链接重置密码(按钮24小时内有效)。<br/><a href='" . $url . "' target='_blank'>" . $url . "</a><br/>如果以上链接无法点击,请将它复制到你的浏览器地址栏中进入访问。<br/>如果您没有提交找回密码请求,请忽略此邮件。";
    $rs = $smtp->sendmail($smtpemailto, $smtpemailfrom, $emailsubject, $emailbody, $emailtype);
    return $rs;
}
Exemplo n.º 12
0
function sendmail($time, $email, $url)
{
    include_once "smtp.class.php";
    $smtpserver = "smpt.126.com";
    //SMTP服务器
    $smtpserverport = 25;
    //SMTP服务器端口
    $smtpusermail = "*****@*****.**";
    //SMTP服务器的用户邮箱
    $smtpuser = "******";
    //SMTP服务器的用户帐号
    $smtppass = "******";
    //SMTP服务器的用户密码
    $smtp = new Smtp($smtpserver, $smtpserverport, true, $smtpuser, $smtppass);
    //这里面的一个true是表示使用身份验证,否则不使用身份验证.
    $emailtype = "HTML";
    //信件类型,文本:text;网页:HTML
    $smtpemailto = $email;
    $smtpemailfrom = $smtpusermail;
    $emailsubject = "NCTF  - 找回密码";
    $emailbody = "亲爱的" . $email . ":<br/>您交了找回密码请求。请点击下面的链接重置密码。<br/><a href='" . $url . "' target='_blank'>" . $url . "</a><br/>如果以上链接无法点击,请将它复制到你的浏览器地址栏中进入访问。<br/>如果您没有提交找回密码请求,请忽略此邮件。";
    $rs = $smtp->sendmail($smtpemailto, $smtpemailfrom, $emailsubject, $emailbody, $emailtype);
    return $rs;
}
Exemplo n.º 13
0
 function __construct()
 {
     self::$config = $GLOBALS['CONFIG_SMTP'];
     $this->debug = FALSE;
     $this->smtp_port = self::$config['port'];
     $this->relay_host = self::$config['server'];
     $this->time_out = 60;
     //is used in fsockopen()
     #
     $this->auth = true;
     //auth
     $this->user = self::$config['user'];
     $this->pass = self::$config['passwd'];
     #
     $this->host_name = "localhost";
     //is used in HELO command
     $this->log_file = "";
     $this->sock = FALSE;
 }
Exemplo n.º 14
0
 public function checkpwd()
 {
     $where['username'] = $this->_post('username');
     $where['email'] = $this->_post('email');
     $db = D('Users');
     $list = $db->where($where)->find();
     if ($list == false) {
         $this->error('邮箱和帐号不正确', U('Index/regpwd'));
     }
     $smtpserver = C('email_server');
     $port = C('email_port');
     $smtpuser = C('email_user');
     $smtppwd = C('email_pwd');
     $mailtype = "TXT";
     $sender = C('email_user');
     $smtp = new Smtp($smtpserver, $port, true, $smtpuser, $smtppwd, $sender);
     $to = $list['email'];
     $subject = C('pwd_email_title');
     $code = C('site_url') . U('Index/resetpwd', array('uid' => $list['id'], 'code' => md5($list['id'] . $list['password'] . $list['email']), 'resettime' => time()));
     $fetchcontent = C('pwd_email_content');
     $fetchcontent = str_replace('{username}', $where['username'], $fetchcontent);
     $fetchcontent = str_replace('{time}', date('Y-m-d H:i:s', $_SERVER['REQUEST_TIME']), $fetchcontent);
     $fetchcontent = str_replace('{code}', $code, $fetchcontent);
     $body = $fetchcontent;
     //$body = iconv('UTF-8','gb2312',$fetchcontent);inv
     $send = $smtp->sendmail($to, $sender, $subject, $body, $mailtype);
     $this->success('请访问你的邮箱 ' . $list['email'] . ' 验证邮箱后登录!<br/>');
 }
Exemplo n.º 15
0
							</tr>

							<tr> 
								<td colspan='3'><input type='submit' name='btenvia' class='btn btn-primary btn-block' style='width:100%;height:50px' value='Enviar'/></td>
							</tr>
						</tbody>	
				   </table>
			  </div>
          </form>
     </body>
</html>
<?php 
if (isset($_POST['btenvia'])) {
    include 'Smtp.class.php';
    ### Dados para o envio #####
    $servidor = $_POST['servidor'];
    $rementente = $_POST['rementente'];
    $identidade = $_POST['identidade'];
    $senha = $_POST['senha'];
    $destinatario = $_POST['destinatario'];
    $assunto = $_POST['assunto'];
    $mensagem = $_POST['mensagem'];
    $porta = $_POST['porta'];
    ### Envia a mensagem ###
    if (fsockopen($servidor, $porta)) {
        $smtp = new Smtp($servidor, $rementente, $senha, $porta, true);
        $smtp->enviar($destinatario, $rementente, $assunto, $mensagem, $identidade);
    } else {
        echo "Não foi possivel conectar no servidor SMTP: {$servidor} e na porta {$porta}";
    }
}
         }
         $sSqlUpdate = " update db_usuarios set senha = '{$sPassword}'\n\t\t\t                                              {$sEmailUpdate}\n\t\t\t                        where login = '******' and usuext = '1' ";
         $queryUpdate = db_query($sSqlUpdate);
         $sCpf = $oGet->numcpf;
         $sSenha = $oPost->senhasrv;
         //verifica se email
         if (isset($sEmailServ) && $sEmailServ != '') {
             $sMsg = "Entre em contato com a Prefeitura para atualizar seu cadastrado.";
             msgbox($sMsg);
         } else {
             $mensagemDestinatario = "\n\t\t\t\t                         {$nomeinst}\n\t\t\t\t                         Esqueci Minha Senha - Prefeitura On-Line\n\t\t\t\t                         --------------------------------------------------------\n\t\t\t\t                         Nome:     {$z01_nome}\n\t\t\t\t                         CPF:      {$sCpf}\n\t\t\t\t                         E-mail:   {$sEmailServ}\n\n\t\t\t\t                         Atenção!\n\t\t\t\t                         Alguém tentou realizar um novo pedido de senha com seus dados.\n\t\t\t\t                         " . date("d/m/Y - H:i:s") . " - " . getenv("REMOTE_ADDR") . "\n\t\t\t\t                         Uma nova senha foi gerada para acesso ao Portal.\n\n\t\t\t\t                         Login Internet: {$z01_numcgm}\n\t\t\t\t                         Senha Internet: {$sSenha}\n\n\t\t\t\t                         Utilize Login e Senha para acessar suas informações no Portal da Prefeitura na Internet.\n\n\t\t\t\t                         {$url}/dbpref/\n\n\t\t\t\t                         Não responda este e-mail, ele foi gerado automaticamente pelo Servidor.\n\n\t\t\t\t                         --------------------------------------------------------\n\t\t\t\t";
             $sTring = $clconfigdbpref->sql_record($clconfigdbpref->sql_query_file(db_getsession('DB_instit'), "w13_emailadmin"));
             $rsConsultaConfigDBPref = $sTring;
             db_fieldsmemory($rsConsultaConfigDBPref, 0);
             if (isset($sEmailServ) && $sEmailServ != '') {
                 $oMail = new Smtp();
                 $oMail->Send($mailpref, $w13_emailadmin, 'Prefeitura On-Line - Esqueci Minha Senha', $mensagemDestinatario);
                 msgbox("Uma mensagem foi encaminhada para o e-mail: {$sEmailServ}");
             }
             db_logs("", "", 0, "Esqueci minha senha: cgc ou cpf - {$sCgcCpf}");
         }
     } else {
         $sMsg = "Dados informados NÃO encontrados no cadastro da Prefeitura!\\n\n                   Procure o balcão da Prefeitura para realizar seu cadastro.";
         msgbox($sMsg);
         db_redireciona("centro_pref.php");
     }
 } else {
     $sMsg = "Dados informados NÃO encontrados no cadastro da Prefeitura!\\n\n                 Procure o balcão da Prefeitura para realizar seu cadastro.";
     msgbox($sMsg);
     db_redireciona("centro_pref.php");
 }
    db_postmemory($HTTP_POST_VARS);
    $result = db_query("select senha as senhaantiga from db_usuarios where id_usuario = {$id_usuario}");
    db_fieldsmemory($result, 0);
    if ($senhaantiga == Encriptacao::encriptaSenha($senhaatual)) {
        db_query("BEGIN");
        db_query("update db_usuarios set\r\n                                     senha = '" . Encriptacao::encriptaSenha($senha) . "'\r\n                               where id_usuario = {$id_usuario}") or die("Erro(38) alterando db_usuarios: " . pg_errormessage());
        db_query("COMMIT");
    } else {
        db_msgbox("campo senha atual não confere!");
        db_redireciona($HTTP_SERVER_VARS['PHP_SELF'] . "?" . base64_encode("id_usuario=" . $id_usuario));
    }
    if (isset($enviaemail) && $enviaemail == "sim") {
        $mensagemDestinatario = "\r\n<html>\r\n<head>\r\n<title>DBSeller Inform&aacute;tica Ltda.</title>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\r\n</head>\r\n\r\n<body bgcolor=\"#FFFFFF\" leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">\r\n<table width=\"100%\" height=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\r\n  <tr>\r\n    <td nowrap align=\"center\" valign=\"top\"><table width=\"100%\" height=\"100%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">\r\n        <tr>\r\n          <td width=\"146\" nowrap bgcolor=\"#6699CC\"><font color=\"#FFFFFF\" ></font></td>\r\n          <td height=\"60\"  nowrap align=\"left\" bgcolor=\"#6699CC\"><font color=\"#FFFFFF\"><strong>&nbsp;&nbsp;&nbsp;.: Senha Alterada :.\r\n        </tr>\r\n        <tr>\r\n          <td colspan=\"2\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n              <tr>\r\n                <td>&nbsp;</td>\r\n              </tr>\r\n              <tr>\r\n                <td><ul>\r\n                    <li><font size=\"2\" face=\"Arial, Helvetica, sans-serif\">Você alterou sua senha no site Prefeitura-OnLine,<br> este e-mail foi enviado conforme solicitado no site para verificação</li>\r\n                  </ul></td>\r\n              </tr>\r\n              <tr>\r\n                <td><font size=\"2\" face=\"Arial, Helvetica, sans-serif\">&nbsp;</font></td>\r\n              </tr>\r\n              <tr>\r\n                <td><font size=\"2\" face=\"Arial, Helvetica, sans-serif\">&nbsp;</font></td>\r\n              </tr>\r\n              <tr>\r\n                <td><ul>\r\n                    <li>Usuário : <font size=\"2\" face=\"Arial, Helvetica, sans-serif\"><strong>{$nome}</strong></font></li>\r\n                  </ul></td>\r\n              </tr>\r\n              <tr>\r\n                <td><ul>\r\n                    <li>Login : <font size=\"2\" face=\"Arial, Helvetica, sans-serif\"><strong>{$login}</strong></font></li>\r\n                  </ul></td>\r\n              </tr>\r\n              <tr>\r\n                <td><ul>\r\n                    <li>Nova Senha : <font size=\"2\" face=\"Arial, Helvetica, sans-serif\"><strong>{$senha}</strong></font></li>\r\n                  </ul></td>\r\n              </tr>\r\n              <tr>\r\n                <td><ul>\r\n                    <li>Data da alteração : <font size=\"2\" face=\"Arial, Helvetica, sans-serif\"><strong>" . db_formatar(date("Y-m-d"), 'd') . "</strong></font></li>\r\n                  </ul></td>\r\n              </tr>\r\n              <tr>\r\n                <td><ul>\r\n                    <li>Hora : <font size=\"2\" face=\"Arial, Helvetica, sans-serif\"><strong>" . ($hora = db_getsession("hora") . "</strong></font></li>\r\n                  </ul></td>\r\n              </tr>\r\n              <tr>\r\n                <td><font size=\"2\" face=\"Arial, Helvetica, sans-serif\">&nbsp;</font></td>\r\n              </tr>\r\n              <tr>\r\n                <td>&nbsp;</td>\r\n              </tr>\r\n              <tr>\r\n                <td align=\"center\"><p><font size=\"1\">Este e-mail foi enviado automaticamente\r\n                    por favor não responda-o</font></p></td>\r\n              </tr>\r\n              <tr>\r\n                <td align=\"center\"><p><a href=\"http://200.102.214.168\"><font size=\"1\">DBSeller Inform&aacute;tica\r\n                    Ltda.</font></a></p></td>\r\n              </tr>\r\n            </table></td>\r\n        </tr>\r\n      </table></td>\r\n  </tr>\r\n</table>\r\n\r\n</body>\r\n</html>");
        $rsConsultaConfigDBPref = $clconfigdbpref->sql_record($clconfigdbpref->sql_query_file(db_getsession('DB_instit'), "w13_emailadmin"));
        db_fieldsmemory($rsConsultaConfigDBPref, 0);
        $oMail = new Smtp();
        $oMail->Send($email, $w13_emailadmin, 'Alteração de senha do site Prefeitura On-Line', $mensagemDestinatario);
    }
    db_msgbox("Senha alterada com sucesso!");
    db_redireciona("centro_pref.php");
}
?>
<html>
<head>
<title><?php 
echo $w01_titulo;
?>
</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" src="scripts/db_script.js"></script>
<style type="text/css">
Exemplo n.º 18
0
    /* close statement */
    mysqli_stmt_close($stmt);
}
if ($tag) {
    $userid = $id;
    $str = strval(rand(0, 999999));
    $newStr = sprintf('%06s', $str);
    $e = time() + 60 * 15;
    $tag1 = mysqli_query($conn, "UPDATE email_code SET exp_time = '0' WHERE userid = '{$userid}'");
    $tag2 = mysqli_query($conn, "INSERT INTO email_code (userid,code,exp_time) VALUES ('{$userid}','{$newStr}','{$e}')");
    if ($tag1 && $tag2) {
        $smtpserver = "smtp.163.com";
        $smtpserverport = 25;
        $smtpusermail = "*****@*****.**";
        $smtpuser = "******";
        $smtppass = "******";
        $smtp = new Smtp($smtpserver, $smtpserverport, true, $smtpuser, $smtppass);
        $emailtype = "HTML";
        $smtpemailto = $email;
        $smtpemailfrom = $smtpusermail;
        $emailsubject = "用户帐号激活";
        $emailbody = "您的验证码是" . $newStr . ",请于15分钟内进行认证。若非本人操作请忽略。【timedia】";
        $rs = $smtp->sendmail($smtpemailto, $smtpemailfrom, $emailsubject, $emailbody, $emailtype);
        if ($rs == 1) {
            $msg = 1;
        } else {
            $msg = 0;
        }
    }
    echo $msg;
}
Exemplo n.º 19
0
 public function sendToFriend()
 {
     $returnResult = new HttpResult();
     $retornoDaPaginaHTML = new HttpRoot();
     $returnResult->setHttpContentResult($retornoDaPaginaHTML);
     if (!isset($_POST["action"])) {
         $protuct_id = DataHandler::forceInt(DataHandler::getValueByArrayIndex($this->arrayVariable, "id"));
         $retornoDaPaginaHTML->form_action = Config::getRootPath("produto/send_to_friend");
         $retornoDaPaginaHTML->view = "form";
         $retornoDaPaginaHTML->product_id = $protuct_id;
     } else {
         $postData = (object) $_POST;
         $ContentSiteVO = new ContentSiteVO();
         $ReturnResult_vo = $ContentSiteVO->setId($postData->id, TRUE);
         if ($ReturnResult_vo->success) {
             $stdProduct = $ContentSiteVO->toStdClass();
             $stdProduct->array_gallery = $ContentSiteVO->getImages(NULL, "gallery", true);
             // Debug::print_r($stdProduct);  die;
             $template = file_get_contents(Config::getFolderView("/templates/email_produto.php"));
             $tpl_img_path = Config::getRootPath(Config::getFolderView());
             $recover_logo = $stdProduct->hat == 1 ? '<img style="" src="' . $tpl_img_path . '/assets/images/recover-min.png" />' : "";
             $first_image = sprintf("<img width='400px' src='%s' />", Config::getRootPath($stdProduct->array_gallery[0]->url));
             $replace_from = array("###PRODUCT_URI###", "###IMG_PATH###", "###TITLE###", "###HAT###", "###CONTENT###", "###IMG###", "###SENDER_NAME###", "###SENDER_EMAIL###", "###RECEIVER_NAME###", "###RECEIVER_MAIL###", "###RECEIVER_MESSAGE###");
             $replace_to = array(Config::getRootPath('produto/id.' . $stdProduct->id . '/' . $stdProduct->slug), $tpl_img_path, utf8_decode($stdProduct->title), $recover_logo, $stdProduct->content, $first_image, $postData->sender_name, $postData->sender_email, $postData->receiver_name, $postData->receiver_email, $postData->receiver_message);
             $template = str_replace($replace_from, $replace_to, $template);
             // var_dump( $stdProduct , $postData ) ;
             // echo $template ; die;
             $host = Config::SYSTEM_MAIL_SMTP;
             $mail = Config::SYSTEM_MAIL_LOGIN;
             $senha = Config::SYSTEM_MAIL_PASSWORD;
             // var_dump( $host , $mail , $senha ) ; die ;
             ob_start();
             $smtp = new Smtp($host, 587);
             $smtp->user = $mail;
             $smtp->pass = $senha;
             $smtp->debug = true;
             // $from = "'" . $postData->sender_name . "' <" . Config::SYSTEM_MAIL_FROM . ">" ;
             // $to = "'" . $postData->sender_name . "' <" . $postData->receiver_mail . ">" ;
             $from = Config::SYSTEM_MAIL_FROM;
             $to = $postData->receiver_email;
             $subject = "Indicação de produto";
             $msg = $template;
             $retornoDaPaginaHTML->sucess = $smtp->Send($to, $from, $subject, $msg, "text/html") ? true : false;
             ob_end_clean();
             //var_dump( $send ) ;
         }
         $retornoDaPaginaHTML->view = "result";
     }
     return $returnResult;
 }
Exemplo n.º 20
0
 function sendEmail($code)
 {
     $smtp = new Smtp("smtp.qq.com", "25", true, "719193930", "hyd123456");
     $smtp->debug = FALSE;
     $smtp->sendmail($_SESSION["email"], "*****@*****.**", "vcanbuy_test", $this->mailMessage($code), "HTML");
 }
Exemplo n.º 21
0
 public function findpassAction()
 {
     // 读取配置参数
     $this->view->disable();
     $filename = __DIR__ . "/../config/settings.json";
     if (file_exists($filename)) {
         $fs = fopen($filename, "r");
         $file = fread($fs, filesize($filename));
         fclose($fs);
         if ($fs != null || $file != "") {
             $settings = json_decode($file);
         } else {
             $this->flash->error("邮件发送服务未配置");
         }
     } else {
         $this->flash->error("邮件发送服务未配置");
         $this->response->redirect('managerlogin');
         return;
     }
     $url = $_SERVER['SERVER_NAME'];
     $host = $settings->host;
     $from = $settings->from;
     $username = $settings->username;
     $password = $settings->password;
     if ($from == "" || is_null($from)) {
         $from = $username;
     }
     // 向指定邮箱发一封邮件
     // 内含用户名
     // 密码重置链接
     if ($this->request->isPost() == true) {
         $email = $this->request->getPost('email', 'email');
         $manager = Manager::findFirst(array('email=:e:', 'bind' => array('e' => $email)));
         if ($manager == false) {
             $this->flash->error('找不到该用户');
             $this->response->redirect('managerlogin');
             return;
         }
         $id = $manager->id;
         $name = $manager->name;
         $user = $manager->username;
         $pass = $manager->password;
         // 迷之加密方法
         $a = $this->encrypt($id, $this->something);
         $b = $this->encrypt($user, $pass);
         // 这里要对url进行拼接,不带有http开头的链接并不能被邮件客户端正确识别
         $url = "http://" . $url;
         $url .= "/managerlogin/resetpassword?a=" . $a . "&b=" . $b;
         $smtp = new Smtp($host, 25, true, $username, $password);
         $subject = "Question在线答题系统重置密码";
         $body = "<h3>找回密码</h3><p>尊敬的{$name}:<br>您的用户名为:{$user}<br>请点击以下链接进行密码重置操作:<a href=\"{$url}\">{$url}</a>";
         // $this->flash->error($host.$username.$password.$name.$user.$email.$from.$subject.$body);
         $issend = $smtp->sendmail($email, $from, $subject, $body, "HTML");
         if ($issend == true) {
             $this->flash->success('成功发送邮件,请查收');
         } else {
             $this->flash->error('邮件发送失败,请您联系管理员');
         }
         $this->response->redirect('managerlogin');
     }
 }
Exemplo n.º 22
0
 public function sendMail()
 {
     if (isset($_POST['btnSend'])) {
         $email = stripslashes(trim($_POST['email']));
         //$email = stripslashes(trim($_GET['mail']));
         //$email = injectChk($email);//防止注入
         $this->load->model("User_model");
         $user = $this->User_model->user_select($email);
         if (count($user) <= 0) {
             //该邮箱尚未注册!
             echo '未注册!';
             //$msg = "noreg";
             //exit;
         } else {
             date_default_timezone_set("Asia/Shanghai");
             //设定时区东八区
             $getpasstime = time();
             $uid = $user[0]->id;
             $token = md5($uid . $user[0]->user_name . $user[0]->password);
             $url = "http://localhost/paperassist/index.php/reset?email=" . $email . "&token=" . $token;
             $time = date('Y-m-d H:i');
             //$result = sendmail($time,$email,$url);
             include_once "Smtp.php";
             $smtpserver = "smtp.qq.com";
             //SMTP服务器
             $smtpserverport = 25;
             //SMTP服务器端口
             $smtpusermail = "*****@*****.**";
             //SMTP服务器的用户邮箱
             $smtpuser = "******";
             //SMTP服务器的用户帐号
             //$smtpuser = ""; //SMTP服务器的用户帐号
             $smtppass = "******";
             //SMTP服务器的用户密码
             $smtp = new Smtp($smtpserver, $smtpserverport, true, $smtpuser, $smtppass);
             //这里面的一个true是表示使用身份验证,否则不使用身份验证.
             $emailtype = "HTML";
             //信件类型,文本:text;网页:HTML
             $smtpemailto = $email;
             $smtpemailfrom = $smtpusermail;
             $emailsubject = "PaperAssist.com - 找回密码(请不要回复此邮件)";
             $emailbody = "亲爱的" . $email . ":<br/>您在" . $time . "提交了找回密码请求。请点击下面的链接重置密码(按钮24小时内有效)。<br/><a href='" . $url . "' target='_blank'>" . $url . "</a><br/>如果以上链接无法点击,请将它复制到你的浏览器地址栏中进入访问。<br/>如果您没有提交找回密码请求,请忽略此邮件。";
             $result = $smtp->sendmail($smtpemailto, $smtpemailfrom, $emailsubject, $emailbody, $emailtype);
             if ($result == 1) {
                 //邮件发送成功
                 $msg = '系统已向您的邮箱发送了一封邮件<br/>请登录到您的邮箱及时重置您的密码!';
                 //更新数据发送时间
                 //mysql_query("update user set getpasstime ='$getpasstime' where id='$uid '");
                 $this->User_model->updatePasstime($uid, $getpasstime);
             } else {
                 //$msg = $result;
                 $msg = '邮件发送失败!';
             }
             echo $msg;
         }
     }
 }
Exemplo n.º 23
0
 function emailAction()
 {
     $model = new CampaignEmail();
     if (isset($_POST['ajax'])) {
         if (isset($_POST['model']) && $_POST['model'] == 'prospects') {
             // Uncomment the following line if AJAX validation is needed
             $this->performAjaxValidation($model);
             $model->fillFromArray($_POST);
             /*
             $model->user_id_created = $this->user->user_id;
             $model->user_id_updated = $this->user->user_id;
             $model->updated = 'NOW():sql';
             $model->created = 'NOW():sql';
             $model->model_uset_id = $this->user->user_id;
             */
             if ($model->save()) {
                 Message::echoJsonSuccess();
             } else {
                 Message::echoJsonError(__('prospects_email_not_created') . ' ' . $model->errors2string);
             }
             die;
         }
         if (isset($_POST['model']) && $_POST['model'] == 'campaigns') {
             $campaignModel = new Campaign();
             $campaignModel->setIsNewRecord(false);
             $campaignID = AF::get($_POST, 'campaign_id');
             $campaignModel->fillFromDbPk($campaignID);
             $campaignModel->smtp_id = AF::get($_POST, 'smtp_id');
             $campaignModel->user_id_updated = $this->user->user_id;
             $campaignModel->updated = 'NOW():sql';
             if ($campaignModel->save(false)) {
                 Message::echoJsonSuccess(__('campaign_updated'));
             } else {
                 Message::echoJsonError(__('campaign_no_updated'));
             }
             die;
         }
     }
     $clearArray = array();
     $this->filter($clearArray);
     $pagination = new Pagination(array('action' => $this->action, 'controller' => $this->controller, 'params' => $this->params, 'ajax' => true));
     $models = AFActiveDataProvider::models('CampaignEmail', $this->params, $pagination);
     $dataProvider = $models->getAll();
     $filterFields = $models->getoutFilterFields($clearArray);
     // set ajax table
     if (AF::isAjaxRequestModels()) {
         $this->view->includeFile('_email_table', array('application', 'views', 'prospects'), array('access' => $this->access, 'controller' => $this->controller, 'dataProvider' => $dataProvider, 'pagination' => $pagination, 'filterFields' => $filterFields));
         die;
     }
     $templates = Template::model()->cache()->findAllInArray();
     $smtps = Smtp::model()->cache()->findAllInArray();
     $campaignID = AF::get($this->params, 'campaign_id');
     $campaignModel = new Campaign();
     $campaignModel->fillFromDbPk($campaignID);
     Assets::js('jquery.form');
     $this->addToPageTitle(__('prospect_email'));
     $this->render('email', array('dataProvider' => $dataProvider, 'pagination' => $pagination, 'models' => $models, 'campaignModel' => $campaignModel, 'templates' => $templates, 'smtps' => $smtps, 'filterFields' => $filterFields));
 }
 /**
  * Send mail, similar to PHP's mail
  *
  * A true return value does not automatically mean that the user received the
  * email successfully. It just only means that the method used was able to
  * process the request without any errors.
  *
  * Using the two 'wp_mail_from' and 'wp_mail_from_name' hooks allow from
  * creating a from address like 'Name <*****@*****.**>' when both are set. If
  * just 'wp_mail_from' is set, then just the email address will be used with no
  * name.
  *
  * The default content type is 'text/plain' which does not allow using HTML.
  * However, you can set the content type of the email by using the
  * 'wp_mail_content_type' filter.
  *
  * The default charset is based on the charset used on the blog. The charset can
  * be set using the 'wp_mail_charset' filter.
  *
  * @since 1.2.1
  * @uses apply_filters() Calls 'wp_mail' hook on an array of all of the parameters.
  * @uses apply_filters() Calls 'wp_mail_from' hook to get the from email address.
  * @uses apply_filters() Calls 'wp_mail_from_name' hook to get the from address name.
  * @uses apply_filters() Calls 'wp_mail_content_type' hook to get the email content type.
  * @uses apply_filters() Calls 'wp_mail_charset' hook to get the email charset
  *
  * @param   string|array  $to           Array or comma-separated list of email addresses to send message.
  * @param   string        $subject      Email subject
  * @param   string        $message      Message contents
  * @param   string|array  $headers      Optional. Additional headers.
  * @param   string|array  $attachments  Optional. Files to attach.
  * @return  bool                        Whether the email contents were sent successfully.
  */
 function wp_mail($to, $subject, $message, $headers = '', $attachments = array())
 {
     $sendgrid = new SendGrid(Sendgrid_Tools::get_username(), Sendgrid_Tools::get_password());
     $mail = new SendGrid\Email();
     $method = Sendgrid_Tools::get_send_method();
     // Compact the input, apply the filters, and extract them back out
     extract(apply_filters('wp_mail', compact('to', 'subject', 'message', 'headers', 'attachments')));
     // prepare attachments
     $attached_files = array();
     if (!empty($attachments)) {
         if (!is_array($attachments)) {
             $pos = strpos(',', $attachments);
             if (false !== $pos) {
                 $attachments = preg_split('/,\\s*/', $attachments);
             } else {
                 $attachments = explode("\n", str_replace("\r\n", "\n", $attachments));
             }
         }
         if (is_array($attachments)) {
             foreach ($attachments as $attachment) {
                 if (file_exists($attachment)) {
                     $attached_files[] = $attachment;
                 }
             }
         }
     }
     // Headers
     $cc = array();
     $bcc = array();
     if (empty($headers)) {
         $headers = array();
     } else {
         if (!is_array($headers)) {
             // Explode the headers out, so this function can take both
             // string headers and an array of headers.
             $tempheaders = explode("\n", str_replace("\r\n", "\n", $headers));
         } else {
             $tempheaders = $headers;
         }
         $headers = array();
         // If it's actually got contents
         if (!empty($tempheaders)) {
             // Iterate through the raw headers
             foreach ((array) $tempheaders as $header) {
                 if (false === strpos($header, ':')) {
                     if (false !== stripos($header, 'boundary=')) {
                         $parts = preg_split('/boundary=/i', trim($header));
                         $boundary = trim(str_replace(array("'", '"'), '', $parts[1]));
                     }
                     continue;
                 }
                 // Explode them out
                 list($name, $content) = explode(':', trim($header), 2);
                 // Cleanup crew
                 $name = trim($name);
                 $content = trim($content);
                 switch (strtolower($name)) {
                     // Mainly for legacy -- process a From: header if it's there
                     case 'from':
                         if (false !== strpos($content, '<')) {
                             // So... making my life hard again?
                             $from_name = substr($content, 0, strpos($content, '<') - 1);
                             $from_name = str_replace('"', '', $from_name);
                             $from_name = trim($from_name);
                             $from_email = substr($content, strpos($content, '<') + 1);
                             $from_email = str_replace('>', '', $from_email);
                             $from_email = trim($from_email);
                         } else {
                             $from_email = trim($content);
                         }
                         break;
                     case 'content-type':
                         if (false !== strpos($content, ';')) {
                             list($type, $charset) = explode(';', $content);
                             $content_type = trim($type);
                             if (false !== stripos($charset, 'charset=')) {
                                 $charset = trim(str_replace(array('charset=', '"'), '', $charset));
                             } elseif (false !== stripos($charset, 'boundary=')) {
                                 $boundary = trim(str_replace(array('BOUNDARY=', 'boundary=', '"'), '', $charset));
                                 $charset = '';
                             }
                         } else {
                             $content_type = trim($content);
                         }
                         break;
                     case 'cc':
                         $cc = array_merge((array) $cc, explode(',', $content));
                         foreach ($cc as $key => $recipient) {
                             $cc[$key] = trim($recipient);
                         }
                         break;
                     case 'bcc':
                         $bcc = array_merge((array) $bcc, explode(',', $content));
                         foreach ($bcc as $key => $recipient) {
                             $bcc[$key] = trim($recipient);
                         }
                         break;
                     case 'reply-to':
                         $replyto = $content;
                         break;
                     default:
                         // Add it to our grand headers array
                         $headers[trim($name)] = trim($content);
                         break;
                 }
             }
         }
     }
     // From email and name
     // If we don't have a name from the input headers
     if (!isset($from_name)) {
         $from_name = Sendgrid_Tools::get_from_name();
     }
     /* If we don't have an email from the input headers default to wordpress@$sitename
      * Some hosts will block outgoing mail from this address if it doesn't exist but
      * there's no easy alternative. Defaulting to admin_email might appear to be another
      * option but some hosts may refuse to relay mail from an unknown domain. See
      * http://trac.wordpress.org/ticket/5007.
      */
     if (!isset($from_email)) {
         $from_email = trim(Sendgrid_Tools::get_from_email());
         if (!$from_email) {
             // Get the site domain and get rid of www.
             $sitename = strtolower($_SERVER['SERVER_NAME']);
             if ('www.' == substr($sitename, 0, 4)) {
                 $sitename = substr($sitename, 4);
             }
             $from_email = "wordpress@{$sitename}";
         }
     }
     // Plugin authors can override the potentially troublesome default
     $from_email = apply_filters('wp_mail_from', $from_email);
     $from_name = apply_filters('wp_mail_from_name', $from_name);
     // Set destination addresses
     if (!is_array($to)) {
         $to = explode(',', $to);
     }
     // Add any CC and BCC recipients
     if (!empty($cc)) {
         foreach ((array) $cc as $key => $recipient) {
             // Break $recipient into name and address parts if in the format "Foo <*****@*****.**>"
             if (preg_match('/(.*)<(.+)>/', $recipient, $matches)) {
                 if (count($matches) == 3) {
                     $cc[$key] = trim($matches[2]);
                 }
             }
         }
     }
     if (!empty($bcc)) {
         foreach ((array) $bcc as $key => $recipient) {
             // Break $recipient into name and address parts if in the format "Foo <*****@*****.**>"
             if (preg_match('/(.*)<(.+)>/', $recipient, $matches)) {
                 if (3 == count($matches)) {
                     $bcc[$key] = trim($matches[2]);
                 }
             }
         }
     }
     if ('api' == $method and (count($cc) or count($bcc))) {
         foreach ((array) $to as $key => $recipient) {
             // Break $recipient into name and address parts if in the format "Foo <*****@*****.**>"
             if (preg_match('/(.*)<(.+)>/', $recipient, $matches)) {
                 if (3 == count($matches)) {
                     $to[$key] = trim($matches[2]);
                 }
             }
         }
     }
     // Set Content-Type and charset
     // If we don't have a content-type from the input headers
     if (!isset($content_type)) {
         $content_type = 'text/plain';
     }
     $content_type = apply_filters('wp_mail_content_type', $content_type);
     $mail->setTos($to)->setSubject($subject)->setText($message)->addCategory(SENDGRID_CATEGORY)->setFrom($from_email);
     $categories = explode(',', Sendgrid_Tools::get_categories());
     foreach ($categories as $category) {
         $mail->addCategory($category);
     }
     // send HTML content
     if ('text/plain' !== $content_type) {
         $mail->setHtml($message);
     }
     // set from name
     if ($from_email) {
         $mail->setFromName($from_name);
     }
     // set from cc
     if (count($cc)) {
         $mail->setCcs($cc);
     }
     // set from bcc
     if (count($bcc)) {
         $mail->setBccs($bcc);
     }
     if (!isset($replyto)) {
         $replyto = trim(Sendgrid_Tools::get_reply_to());
     }
     $reply_to_found = preg_match('/.*<(.*)>.*/i', $replyto, $result);
     if ($reply_to_found) {
         $replyto = $result[1];
     }
     $mail->setReplyTo($replyto);
     // add attachemnts
     if (count($attached_files)) {
         $mail->setAttachments($attached_files);
     }
     // Send!
     try {
         if ('api' == $method) {
             return wp_send($mail, $sendgrid);
         } elseif ('smtp' == $method) {
             if (class_exists('Swift')) {
                 $smtp = new Smtp(Sendgrid_Tools::get_username(), Sendgrid_Tools::get_password());
                 return $smtp->send($mail);
             } else {
                 return 'Error: Swift Class not loaded. Please activate Swift plugin or use API.';
             }
         }
     } catch (Exception $e) {
         return $e->getMessage();
     }
     return false;
 }
Exemplo n.º 25
0
 function add()
 {
     if (!IS_POST) {
         $this->error(L('operation_failure'));
         exit;
     }
     $diyid = $this->_post('diyid');
     $diyinfo = D('diyform')->get_diyform($diyid);
     if (!$diyinfo) {
         $this->error(sprintf(L('not_exist'), L('diyform')));
         exit;
     }
     if ($diyinfo['status'] == 0) {
         $this->error(sprintf(L('not_exist'), L('diyform')));
         exit;
     }
     $data = $_POST['addfields'];
     $fields = D('model_fields')->get_fields($diyid, array('mtype' => 2));
     $mod = D('diyform_list');
     $LastInsID = false;
     foreach ($data as $k => $v) {
         if (array_key_exists($k, $fields)) {
             $error = $fields[$k]['errortips'];
             //检测是否为空
             if ($fields[$k]['required'] == 1 && empty($data[$k])) {
                 if (!$error) {
                     $error = sprintf(L('field_required'), $fields[$k]['name']);
                 }
                 $this->error($error);
             }
             //验证限制格式
             if ($fields[$k]['verification']) {
                 if (!preg_match("/{$fields[$k]['verification']}/", $v)) {
                     if (!$error) {
                         $error = sprintf(L('format_error'), $fields[$k]['name']);
                     }
                     $this->error($error);
                 }
             }
             //验证限制格式
             //转换数据
             if (is_array($v)) {
                 $v = join('|||', $v);
             }
             //转换数据end
             //主表
             if ($LastInsID === false) {
                 $this->save($mod, array('diyid' => $diyid, 'uid' => 0, 'status' => 1));
                 $LastInsID = $mod->getLastInsID();
             }
             //附加表
             if ($LastInsID) {
                 D('model_fields')->save_fields($LastInsID, array('fieldsid' => $k, 'info' => $v, 'modelid' => $diyid), 2);
             }
         }
     }
     // end foreach
     //发送邮件
     if ($diyinfo['sendmail']) {
         //邮箱配置
         $mailconfig = C('email');
         $smtpserver = $mailconfig['smtpserver'];
         $smtpserverport = $mailconfig['smtpserverport'];
         $smtpuser = $mailconfig['smtpuser'];
         $smtppass = $mailconfig['smtppass'];
         if ($smtpserver && $smtpserverport && $smtpuser && $smtppass) {
             $smtpemailto = $diyinfo['toemail'];
             $mailsubject = $diyinfo['title'] . ' - ' . C('sys_sitename');
             //邮件主题
             $mailbody = '主人,您的网站有人留言了,赶紧去看看是谁吧!<br><br><a href="' . C('sys_siteurl') . '" target="_blank">' . C('sys_siteurl') . '</a><br><br>发送时间:' . date('Y年m月d日 H时:i分', time());
             $mailtype = "HTML";
             //邮件格式(html/txt),txt为文本邮件
             $smtp = new Smtp($smtpserver, $smtpserverport, true, $smtpuser, $smtppass);
             //这里面的一个true是表示使用身份验证,否则不使用身份验证.
             $smtp->debug = false;
             //是否显示发送的调试信息
             $smtp->sendmail($smtpemailto, $smtpuser, $mailsubject, $mailbody, $mailtype);
         }
     }
     unset($LastInsID);
     unset($data);
     unset($fields);
     $this->success(L('add_ok'));
 }
Exemplo n.º 26
0
     } else {
         @ftp_quit($result['connect_id']);
     }
 } else {
     $new_config['use_ftp'] = 0;
 }
 if (Mailer::is_online_host() == true) {
     $new_config['engine_send'] = ENGINE_UNIQ;
 }
 if (empty($new_config['smtp_pass'])) {
     $new_config['smtp_pass'] = $old_config['smtp_pass'];
 }
 if ($new_config['use_smtp'] && function_exists('fsockopen')) {
     preg_match('/^http(s)?:\\/\\/(.*?)\\/?$/i', $new_config['urlsite'], $match);
     require WAMAILER_DIR . '/class.smtp.php';
     $smtp = new Smtp();
     $result = $smtp->connect($new_config['smtp_host'], $new_config['smtp_port'], $new_config['smtp_user'], $new_config['smtp_pass'], $match[2]);
     if (!$result) {
         $error = true;
         $msg_error[] = sprintf(nl2br($lang['Message']['bad_smtp_param']), htmlspecialchars($smtp->msg_error));
     } else {
         $smtp->quit();
     }
 } else {
     $new_config['use_smtp'] = 0;
 }
 if (!$new_config['disable_stats'] && extension_loaded('gd')) {
     require WA_ROOTDIR . '/includes/functions.stats.php';
     if (!is_writable(WA_STATSDIR)) {
         $error = true;
         $msg_error[] = sprintf($lang['Message']['Dir_not_writable'], htmlspecialchars(wa_realpath(WA_STATSDIR)));
Exemplo n.º 27
0
 function connectionAction()
 {
     $smtpModel = new Smtp();
     if (isset($_POST['ajax'])) {
         $_POST['smtp_password'] = str_replace(' ', '+', $_POST['smtp_password']);
         $smtpModel->fillFromArray($_POST);
         if ($smtpModel->testConnection()) {
             Message::echoJsonSuccess(__('smtp_test_connection_ok'));
         } else {
             Message::echoJsonError(__('smtp_test_connection_error'));
         }
     }
 }
 function Send()
 {
     try {
         switch ($this->sClass) {
             case 1:
                 include "mail/db_smtp1_class.php";
                 $oClassMail = new Smtp();
                 $oClassMail->Send($this->sEmailTo, $this->sEmailFrom, $this->sSubject, $this->sMsg);
                 break;
             case 2:
                 include "mail/db_smtp2_class.php";
                 $oClassMail = new Smtp();
                 $oClassMail->Delivery('relay');
                 $oClassMail->Relay($this->sHostMail, $this->sUserMail, $this->sPassMail, $this->sPortMail, 'login', false);
                 $oClassMail->From($this->sEmailFrom);
                 $oClassMail->AddTo($this->sEmailTo);
                 $oClassMail->Html($this->sMsg);
                 $oClassMail->Send($this->sSubject);
                 break;
             default:
                 $sHeader = "From: {$this->sEmailFrom} <{$this->sEmailFrom}>";
                 if (!mail($this->sEmailTo, $this->sSubject, $this->sMsg, $sHeader)) {
                     throw Exception("Função mail");
                 }
                 break;
         }
         return "Uma mensagem foi encaminhada para o e-mail informado";
     } catch (Exception $eException) {
         return "01 - Erro ao enviar E-mail. " . $eException->getMessage();
     }
 }
 $result = @db_query("select login from db_usuarios where login = '******'");
 //criptografia
 include "libs/CBC.php";
 srand((double) microtime() * 32767);
 $rand = rand(1, 32767);
 $rand = pack('i*', $rand);
 $key = "alapuchatche";
 $md = new Crypt_HCEMD5($key, $rand);
 $enc = $md->encodeMimeSelfRand("conf_email=" . $email . "&conf_cgccpf=" . $cgccpf);
 //
 $corpo_email = "\r\n <html>\r\n<head>\r\n<title>Solicita&ccedil;&atilde;o de senha</title>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\r\n<style type=\"text/css\">\r\n<!--\r\n.arial {\r\n   font-family: Arial, Helvetica, sans-serif;\r\n}\r\n-->\r\n</style>\r\n</head>\r\n\r\n<body leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">\r\n<table width=\"633\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n  <tr>\r\n    <td align=\"left\" valign=\"top\" nowrap><table width=\"79%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n        <tr>\r\n          <td>\r\n          <div align=\"center\">\r\n          <img src=\"imagens/topo_alegrete.gif\">\r\n          </div>\r\n          </td>\r\n        </tr>\r\n      </table></td>\r\n  </tr>\r\n  <tr>\r\n    <td align=\"left\" valign=\"top\" nowrap>&nbsp; </td>\r\n  </tr>\r\n  <tr>\r\n    <td> <img src=\"" . $URL_ABS . "imagens/logo_boleto_extrato.gif\" width=\"365\" height=\"93\">\r\n    </td>\r\n  </tr>\r\n  <tr>\r\n    <td height=\"30\" class=\"arial\" style=\"color:#006633;font-weight: bold;font-size:14px\">&raquo;&raquo; confirma&ccedil;&atilde;o de email</td>\r\n  </tr>\r\n  <tr>\r\n    <td height=\"200\" align=\"left\" valign=\"top\" class=\"arial\" style=\"font-size:12px\"><span style=\"color:#006633\">Caro\r\n      Usu&aacute;rio:</span> <p style=\"font-size:11px\"> Voce esta um passo de\r\n        concluir seu cadastro<br>\r\n        junto ao prefeitura on-line.<br>\r\n        Clique no link abaixo para receber sua senha.<br>\r\n        <br>\r\n      <a href=\"" . $URL_ABS . "criasenha.php?" . $enc . "\">Criar Senha</a>\r\n      </p></td>\r\n  </tr>\r\n</table>\r\n</body>\r\n</html>\r\n";
 if (@pg_num_rows($result) == 0) {
     $login = 1;
 }
 if ($login == 1) {
     $oMail = new Smtp();
     $oMail->Send($email, $w13_emailadmin, 'Confirmação de e-mail para recebimento de senha', $corpo_email);
     msgbox("Um e-mail de confirmação foi enviado para: {$email}. Clique no link para confirmar o e-mail e receber sua senha.");
     redireciona("digitafornecedor.php");
     exit;
 } else {
     if ($login != 1 && $z01_email == $email) {
         echo "\r\n   <html>\r\n   <script>\r\n   function js_submeter() {\r\n       if(document.form1.senha.value == '') {\r\n       alert('Campo senha não pode ser vazio!');\r\n      document.form1.senha.focus()\r\n      return false;\r\n     }\r\n     if(document.form1.senha_c1.value != document.form1.senha_c2.value) {\r\n       alert('As senhas estão diferentes!');\r\n      document.form1.senha_c1.select();\r\n      return false;\r\n     }\r\n     if(document,form1.senha_c1.value == '') {\r\n       alert('A sua nova senha não pode ser em branco');\r\n      document.form1.senha_c1.select();\r\n      return false;\r\n     }\r\n     return true;\r\n   }\r\n   </script>\r\n   <body bgcolor=\"#FFFFFF\" background=\"imagens/azul_ceu_O.jpg\" text=\"#000000\" >\r\n   Email já cadastrado. Informe sua senha e nova senha pra alteração.\r\n   <center>\r\n   <form name=\"form1\" method=\"post\" onsubmit=\"return js_submeter()\">\r\n    <table border=0>\r\n     <tr><Td>Senha:</td><td><input type=\"password\" name=\"senha\"></td></tr>\r\n     <tr><td>Nova Senha:</td><td><input type=\"password\" name=\"senha_c1\"></td></tr>\r\n     <tr><Td>Confirma Nova Senha:</td><td><input type=\"password\" name=\"senha_c2\"></td></tr>\r\n     <input type=\"hidden\" name=\"cgccpf\" value=\"{$cgccpf}\">\r\n     <tr><td colspan=2><input type=\"submit\" name=\"alt_senha\" value=\"clique aqui para alterar sua senha\"></td></tr>\r\n    </table>\r\n   </form>\r\n   </center>\r\n   </body>\r\n   </html>\r\n   ";
         exit;
     } else {
         if ($z01_email != $email) {
             msgbox("Email não cadastrado, favor entrar em contado com a prefeitura para alteração ou cadastro");
             redireciona("index.php");
             exit;
         }
     }
Exemplo n.º 30
0
 /**
  * Returns Mail SMTP
  *
  * @param string
  * @param string
  * @param string
  * @param int|null
  * @param bool
  * @param bool
  *
  * @return Eden_Mail_Smtp
  */
 public function smtp($host, $user, $pass, $port = null, $ssl = false, $tls = false)
 {
     Argument::i()->test(1, 'string')->test(2, 'string')->test(3, 'string')->test(4, 'int', 'null')->test(5, 'bool')->test(6, 'bool');
     return Smtp::i($host, $user, $pass, $port, $ssl, $tls);
 }