저자: Jhon Lennon S. almeida (jhonlennon21@gmail.com)
예제 #1
0
 protected function test_message()
 {
     $mail = new SMail(new DateTime('2009-02-13 15:47:25', new DateTimeZone('Europe/Paris')));
     $mail->add_to('*****@*****.**', 'John Doe');
     $mail->set_text('test');
     return $mail;
 }
예제 #2
0
파일: smtp.php 프로젝트: Kervinou/OBM
 public function send(SMail $mail)
 {
     if (!isset($this->socket)) {
         $this->connect();
         $this->helo();
     } else {
         $this->rset();
     }
     $this->mail($mail->get_return_path());
     foreach ($mail->get_recipients() as $recipient) $this->rcpt($recipient);
     return $this->data($mail->__toString());
 }
예제 #3
0
 public function perform()
 {
     if (!$this->canPerform()) {
         return;
     }
     $news = $this->getNews();
     if (empty($news)) {
         return;
     }
     $urls = array();
     foreach ($news as $news) {
         if (!empty($news->url)) {
             $urls[$news->buildUrl(array(), false)][] = $news;
         }
     }
     $c = new Connection(array(CURLOPT_SSL_VERIFYPEER => 0, CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_NOBODY => true, CURLOPT_MAXREDIRS => 1));
     foreach ($urls as $url => $news) {
         $c->addRequest(new ConnectionRequest($url));
     }
     $requests = $c->run();
     foreach ($requests as $i => $request) {
         foreach ($urls[$request->url] as $news) {
             $result = $request->reply->result == 0 ? $request->reply->info['http_code'] : $request->reply->result;
             /** @var News $news */
             if ($news->url_status != $result) {
                 $news->updateByPk($news->id, array('url_status' => $result));
                 if ($result !== 200) {
                     SMail::sendMail(Yii::app()->params->notifyEmail, 'Новость "' . $news->name . '" не доступна.', 'NewsUrlCheckError', array('news' => $news, 'request' => $request));
                 }
             }
         }
     }
 }
예제 #4
0
파일: sendmail.php 프로젝트: Kervinou/OBM
 public function send(SMail $mail)
 {
     $to = $mail->get_to();
     $subject = $mail->get_subject();
     
     $result = mail($to, $subject, $mail->get_content(), $mail->get_non_matching_header_lines(array('To', 'Subject')), '-f '.$mail->get_return_path());
     
     if (!$result) throw new Exception('Unable to send mail');
 }
예제 #5
0
파일: SmtpTest.php 프로젝트: Kervinou/OBM
 public function test_send()
 {
     $mail = new SMail();
     $mail->set_from('root@localhost');
     $mail->add_to('root@localhost', 'John Doe');
     $mail->set_text('test');
     $mail->set_html_text('<b>test</b>');
     $this->assertTrue($mail->send($this->smtp));
 }
예제 #6
0
 public function btnEnviar_Clicked($sender, $param)
 {
     $pass = "";
     $usuario = Conexion::Retorna_Campo($this->dbConexion, "cat_aut_00_usuarios", "id_usuario", array("usuario" => $this->txtUsuario->Text));
     $direccion = Conexion::Retorna_Campo($this->dbConexion, "gencatusuariodetalle", "email", array("idUsuario" => $usuario));
     if ($direccion != "") {
         for ($i = 0; $i < 10; $i++) {
             $rand = mt_rand(1, 3);
             $rand = $rand == 1 ? mt_rand(48, 57) : ($rand == 2 ? mt_rand(65, 90) : mt_rand(97, 122));
             $pass .= chr($rand);
         }
         $parametros = array("password" => md5(strtoupper($pass)));
         $busqueda = array("idUsuario" => $usuario);
         Conexion::Actualiza_Registro($this->dbConexion, "gencatusuario", $parametros, $busqueda);
         $master_mail = Conexion::Retorna_Campo($this->dbConexion, "gencatvariables", "valor", array("variable" => "solmail"));
         SMail::Envia_Correo($direccion, "Nueva contraseña del sistema de solicitudes de " . "transparencia municipal", "Estimado usuario:\n\nSu nueva contraseña de acceso al " . "sistema de solicitudes de transparencia es: " . $pass . "\n\n", $master_mail);
         $this->getClientScript()->registerBeginScript("enviado", "alert('Se ha enviado un correo a su cuenta registrada con su nueva contraseña.');\n" . "document.location.href = 'index.php?page=usuarios.login';\n");
     } else {
         $this->getClientScript()->registerBeginScript("no_usuario", "alert('Usuario no válido.');\n");
     }
 }
예제 #7
0
 public function send(SMail $mail) {
   self::$mailQ[] = array('to' => $mail->get_to(), 'subject' => $mail->get_subject(), 'content' => $mail->get_content());
 }
예제 #8
0
 public function actionSigninPlatform()
 {
     if (!Yii::app()->user->isGuest) {
         $this->redirect('/');
     }
     $user = new Users('signin');
     if (isset($_POST['Users'])) {
         $user->attributes = $_POST['Users'];
     }
     $user->role = Users::ROLE_PLATFORM;
     $user->status = Users::STATUS_MODERATION;
     $platform = new Platforms('signin');
     if (isset($_POST['Platforms'])) {
         $platform->attributes = $_POST['Platforms'];
     }
     $platform->is_active = 0;
     if (isset($_POST['Users']) && isset($_POST['Platforms'])) {
         $user->validate();
         $platform->validate();
         if (!$user->hasErrors() && !$platform->hasErrors()) {
             $transaction = $user->getDbConnection()->beginTransaction();
             if ($user->save(false)) {
                 $platform->user_id = $user->id;
                 if ($platform->save(false)) {
                     SMail::sendMail(Yii::app()->params['registrationEmail'], 'Регистрация пользователя ' . $user->email, 'SignInRequest', array('user' => $user));
                     $transaction->commit();
                     $this->redirect(array('users/signinSuccess'));
                 }
             }
             $transaction->rollback();
         }
     }
     $this->render('signin_platform', array('user' => $user, 'platform' => $platform));
 }
예제 #9
0
파일: mailer.php 프로젝트: Kervinou/OBM
 protected function create($method_name, $args)
 {
     $mail = new SMail($this->date);
     
     if (is_array($this->from)) $mail->set_from($this->from[0], $this->from[1]);
     else $mail->set_from($this->from);
     
     if (!is_array($this->recipients)) $this->recipients = array($this->recipients);
     foreach ($this->recipients as $to) {
         if (is_array($to)) $mail->add_to($to[0], $to[1]);
         else $mail->add_to($to);
     }
     
     $mail->set_subject($this->subject);
     
     if (is_array($this->body)) {
         $template = $this->get_template_name($method_name);
         if (file_exists($this->get_template_path($template.'.plain')))
             $mail->set_text($this->render($template.'.plain', $this->body));
         if (file_exists($this->get_template_path($template.'.html')))
             $mail->set_html_text($this->render($template.'.html', $this->body));
     } elseif (is_string($this->body) && !empty($this->body)) {
         $mail->set_text($this->body);
     }
     
     foreach ($this->parts as $p) {
         $p = array_merge(self::$part_defaults, $p);
         $mail->add_part($p['content'], $p['content_type'], $p['encoding'], $p['charset']);
     }
     
     foreach ($this->attachments as $a) {
         $a = array_merge(self::$attachment_defaults, $a);
         $mail->add_attachment($a['content'], $a['filename'], $a['content_type'], $a['encoding']);
     }
     
     $this->reset();
     
     return $mail;
 }
예제 #10
0
파일: MailTest.php 프로젝트: Kervinou/OBM
    public function test_send()
    {
        $message = <<<EOT
Date: Fri, 13 Feb 09 15:47:25 +0100
MIME-Version: 1.0
To: John Doe <*****@*****.**>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 8bit

test
EOT;
        $mail = new SMail($this->date);
        $mail->add_to('*****@*****.**', 'John Doe');
        $mail->set_text('test');
        $this->assertEquals($message, $mail->send(new SDummyTransport()));
    }
예제 #11
0
 public function send(SMail $mail)
 {
     SLogger::get_instance()->log($mail->__toString());
 }
예제 #12
0
 public function send(SMail $mail)
 {
     return $mail->__toString();
 }