当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPMailer::getSentMIMEMessage方法代码示例

本文整理汇总了PHP中PHPMailer::getSentMIMEMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPMailer::getSentMIMEMessage方法的具体用法?PHP PHPMailer::getSentMIMEMessage怎么用?PHP PHPMailer::getSentMIMEMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPMailer的用法示例。


在下文中一共展示了PHPMailer::getSentMIMEMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: enviar

 function enviar()
 {
     if ($this->cliente->getAccessToken()) {
         $service = new Google_Service_Gmail($this->cliente);
         try {
             $mail = new PHPMailer();
             $mail->CharSet = "UTF-8";
             $mail->From = Contants::FROM;
             $mail->FromName = Contants::ALIAS;
             $mail->AddAddress($this->destino);
             $mail->AddReplyTo(Contants::FROM, Contants::ALIAS);
             $mail->Subject = $this->asunto;
             $mail->Body = $this->mensaje;
             $mail->preSend();
             $mime = $mail->getSentMIMEMessage();
             $mime = rtrim(strtr(base64_encode($mime), '+/', '-_'), '=');
             $mensaje = new Google_Service_Gmail_Message();
             $mensaje->setRaw($mime);
             $service->users_messages->send('me', $mensaje);
             $r = 1;
         } catch (Exception $e) {
             print $e->getMessage();
             $r = 0;
         }
     } else {
         $r = -1;
     }
     return $r;
 }
开发者ID:maguria,项目名称:usuariosPlantillas,代码行数:29,代码来源:Email.php

示例2: testSigning

 /**
  * S/MIME Signing tests (self-signed).
  * @requires extension openssl
  */
 public function testSigning()
 {
     $this->Mail->Subject .= ': S/MIME signing';
     $this->Mail->Body = 'This message is S/MIME signed.';
     $this->buildBody();
     $dn = ['countryName' => 'UK', 'stateOrProvinceName' => 'Here', 'localityName' => 'There', 'organizationName' => 'PHP', 'organizationalUnitName' => 'PHPMailer', 'commonName' => 'PHPMailer Test', 'emailAddress' => 'phpmailer@example.com'];
     $keyconfig = ["digest_alg" => "sha256", "private_key_bits" => 2048, "private_key_type" => OPENSSL_KEYTYPE_RSA];
     $password = 'password';
     $certfile = 'certfile.pem';
     $keyfile = 'keyfile.pem';
     //Make a new key pair
     $pk = openssl_pkey_new($keyconfig);
     //Create a certificate signing request
     $csr = openssl_csr_new($dn, $pk);
     //Create a self-signed cert
     $cert = openssl_csr_sign($csr, null, $pk, 1);
     //Save the cert
     openssl_x509_export($cert, $certout);
     file_put_contents($certfile, $certout);
     //Save the key
     openssl_pkey_export($pk, $pkeyout, $password);
     file_put_contents($keyfile, $pkeyout);
     $this->Mail->sign($certfile, $keyfile, $password);
     $this->assertTrue($this->Mail->send(), 'S/MIME signing failed');
     $msg = $this->Mail->getSentMIMEMessage();
     $this->assertNotContains("\r\n\r\nMIME-Version:", $msg, 'Incorrect MIME headers');
     unlink($certfile);
     unlink($keyfile);
 }
开发者ID:jbs321,项目名称:portfolio,代码行数:33,代码来源:phpmailerTest.php

示例3: send

 function send()
 {
     if ($this->cliente->getAccessToken()) {
         $service = new Google_Service_Gmail($this->cliente);
         try {
             $mail = new PHPMailer();
             $mail->CharSet = "UTF-8";
             $mail->From = $this->from ? null : Constant::_MAILFROM;
             $mail->FromName = $this->alias ? null : Constant::_MAILALIAS;
             $mail->AddAddress($this->to);
             $mail->AddReplyTo($this->from ? null : Constant::_MAILFROM, $this->alias ? null : Constant::_MAILALIAS);
             $mail->Subject = $this->subject;
             $mail->Body = $this->message;
             $mail->preSend();
             $mail->isHTML();
             $mime = $mail->getSentMIMEMessage();
             $mime = rtrim(strtr(base64_encode($mime), '+/', '-_'), '=');
             $mensaje = new Google_Service_Gmail_Message();
             $mensaje->setRaw($mime);
             $service->users_messages->send('me', $mensaje);
             $r = 1;
         } catch (Exception $e) {
             print $e->getMessage();
             $r = 0;
         }
     } else {
         $r = -1;
     }
     return $r;
 }
开发者ID:jmroldan91,项目名称:userget,代码行数:30,代码来源:Mail.php

示例4: sendMail

 function sendMail($origen, $alias, $destino, $asunto, $mensaje)
 {
     if ($this->client->getAccessToken()) {
         $service = new Google_Service_Gmail($this->client);
         try {
             $mail = new PHPMailer();
             $mail->CharSet = "UTF-8";
             $mail->From = $origen;
             $mail->FromName = $alias;
             $mail->AddAddress($destino);
             $mail->AddReplyTo($origen, $alias);
             $mail->Subject = $asunto;
             $mail->Body = $mensaje;
             $mail->preSend();
             $mime = $mail->getSentMIMEMessage();
             $mime = rtrim(strtr(base64_encode($mime), '+/', '-_'), '=');
             $mensaje = new Google_Service_Gmail_Message();
             $mensaje->setRaw($mime);
             $service->users_messages->send('me', $mensaje);
             return 1;
         } catch (Exception $e) {
             return 0;
         }
     } else {
         return -1;
     }
 }
开发者ID:developdms,项目名称:Practica-4,代码行数:27,代码来源:Mailer.php

示例5: testAddressEscaping

 /**
  * Test address escaping.
  */
 public function testAddressEscaping()
 {
     $this->Mail->Subject .= ': Address escaping';
     $this->Mail->clearAddresses();
     $this->Mail->addAddress('foo@example.com', 'Tim "The Book" O\'Reilly');
     $this->Mail->Body = 'Test correct escaping of quotes in addresses.';
     $this->buildBody();
     $this->Mail->preSend();
     $b = $this->Mail->getSentMIMEMessage();
     $this->assertTrue(strpos($b, 'To: "Tim \\"The Book\\" O\'Reilly" <foo@example.com>') !== false);
 }
开发者ID:ahmedash95,项目名称:Lily,代码行数:14,代码来源:phpmailerTest.php

示例6: PHPMailer

 static function sendActivationMail2($destinatario, $asuntoMensaje, $contenidoMensaje)
 {
     session_start();
     $activacion = sha1($destinatario . Constant::SEMILLA);
     $origen = "jjorgosogarcia@gmail.com";
     $alias = "Jonathan";
     $destino = $destinatario;
     $asunto = $asuntoMensaje;
     $mensaje = $contenidoMensaje;
     require_once 'googleMail/Google/autoload.php';
     require_once 'googleMail/class.phpmailer.php';
     //las últimas versiones también vienen con autoload
     $cliente = new Google_Client();
     $cliente->setApplicationName(Constant::APPLICATIONAME);
     $cliente->setClientId(Constant::CLIENTID);
     $cliente->setClientSecret(Constant::SECRETCLIENTID);
     $cliente->setRedirectUri(Constant::URI);
     $cliente->setScopes('https://www.googleapis.com/auth/gmail.compose');
     $cliente->setAccessToken(file_get_contents('../clases/googleMail/token.conf'));
     if ($cliente->getAccessToken()) {
         $service = new Google_Service_Gmail($cliente);
         try {
             $mail = new PHPMailer();
             $mail->CharSet = "UTF-8";
             $mail->From = $origen;
             $mail->FromName = $alias;
             $mail->AddAddress($destino);
             $mail->AddReplyTo($origen, $alias);
             $mail->Subject = $asunto;
             $mail->Body = $mensaje;
             $mail->preSend();
             $mime = $mail->getSentMIMEMessage();
             $mime = rtrim(strtr(base64_encode($mime), '+/', '-_'), '=');
             $mensaje = new Google_Service_Gmail_Message();
             $mensaje->setRaw($mime);
             $service->users_messages->send('me', $mensaje);
             echo "correo enviado correctamente";
         } catch (Exception $e) {
             print "Error en el envio del correo " . $e->getMessage;
         }
     } else {
         echo "no conectado con gmail";
     }
 }
开发者ID:jjorgosogarcia,项目名称:usuarios,代码行数:44,代码来源:SendGoogleMail.php

示例7: sendMail

 static function sendMail($destino)
 {
     $origen = "carlosgrgrweb@gmail.com";
     $asunto = "Validación";
     $sha1 = sha1($destino . Constants::SEMILLA);
     $mensaje = "Hola. Se ha dado de alta en la base de datos. \n        Ya solo queda activar la cuenta pulsando sobre el siguiente enlace:\n        https://usuarios-carlosgrgr.c9users.io/phpactivar.php?email={$destino}&sha1={$sha1}";
     $cliente = new Google_Client();
     $cliente->setApplicationName('ProyectoEnviarCorreoDesdeGmail');
     $cliente->setClientId('144315405047-hu44apt2g5q2akupkjalbk66ctmm0irb.apps.googleusercontent.com');
     $cliente->setClientSecret('A40mAiwufd0-UvupZDkCMJCE');
     $cliente->setRedirectUri('https://gestionusuario-carlosgrgr.c9users.io/oauth/guardar.php');
     $cliente->setScopes('https://www.googleapis.com/auth/gmail.compose');
     $cliente->setAccessToken(file_get_contents('./oauth/token.conf'));
     if ($cliente->getAccessToken()) {
         $service = new Google_Service_Gmail($cliente);
         try {
             $mail = new PHPMailer();
             $mail->CharSet = "UTF-8";
             $mail->From = $origen;
             //El correo que manda
             $mail->FromName = $alias;
             //El nombre con el que llega
             $mail->AddAddress($destino);
             //A donde se manda
             $mail->AddReplyTo($origen, $alias);
             $mail->Subject = $asunto;
             //Asunto
             $mail->Body = $mensaje;
             //Mensaje
             $mail->preSend();
             $mime = $mail->getSentMIMEMessage();
             $mime = rtrim(strtr(base64_encode($mime), '+/', '-_'), '=');
             $mensaje = new Google_Service_Gmail_Message();
             $mensaje->setRaw($mime);
             $r = $service->users_messages->send('me', $mensaje);
             echo "se ha enviado";
         } catch (Exception $e) {
             print "Error en el envío de correo" . $e->getMessage();
         }
     } else {
         echo "no conectado con gmail";
     }
     return $r = $r["labelIds"][0];
 }
开发者ID:carlosgrgr,项目名称:gestionUsuarios,代码行数:44,代码来源:Mail.php

示例8: sendMail

 static function sendMail($destino)
 {
     $origen = "miguel.fdez.castillo@gmail.com";
     $asunto = "WU User";
     $destino = $destino;
     $alias = "Mike";
     $sha1 = sha1($destino . Constants::SEMILLA);
     $mensaje = "Saludos Usuario. Para completar su registro en WU pulse el siguiente enlace:\n        https://wusuario-miguelfdez79.c9users.io/wu/phpdardealta.php?email={$destino}&sha1={$sha1}";
     $cliente = new Google_Client();
     $cliente->setApplicationName('ProyectoEnviarCorreo');
     $cliente->setClientId('560186546771-323f2k7vuhfr2uma1gdc3o09gjgtuagr.apps.googleusercontent.com');
     $cliente->setClientSecret('dtpKnyCb9cuaDontUMC-wntA');
     $cliente->setRedirectUri('https://wusuario-miguelfdez79.c9users.io/oauth/guardar.php');
     $cliente->setScopes('https://www.googleapis.com/auth/gmail.compose');
     $cliente->setAccessToken(file_get_contents('../oauth/token.conf'));
     if ($cliente->getAccessToken()) {
         $service = new Google_Service_Gmail($cliente);
         try {
             $mail = new PHPMailer();
             $mail->CharSet = "UTF-8";
             $mail->From = $origen;
             $mail->FromName = $alias;
             $mail->AddAddress($destino);
             $mail->AddReplyTo($origen, $alias);
             $mail->Subject = $asunto;
             $mail->Body = $mensaje;
             $mail->preSend();
             $mime = $mail->getSentMIMEMessage();
             $mime = rtrim(strtr(base64_encode($mime), '+/', '-_'), '=');
             $mensaje = new Google_Service_Gmail_Message();
             $mensaje->setRaw($mime);
             $r = $service->users_messages->send('me', $mensaje);
             echo "se ha enviado";
         } catch (Exception $e) {
             print "Error en el envío de correo" . $e->getMessage();
         }
     } else {
         echo "no conectado con gmail";
     }
     return $r["labelIds"][0];
 }
开发者ID:Miguelfdez79,项目名称:wusuario,代码行数:41,代码来源:Mail.php

示例9: PHPMailer

//las últimas versiones también vienen con autoload
$cliente = new Google_Client();
$cliente->setApplicationName('ProyectoEnviarCorreo');
$cliente->setClientId('304670743598-f6luuojm498kah8fnuqarr0mmcrg918n.apps.googleusercontent.com');
$cliente->setClientSecret('ep2o5eER7ELsUJvptEEkonTk');
$cliente->setRedirectUri('https://pruebacorreo-juanmanuelolalla.c9users.io/oauth/guardar.php');
$cliente->setScopes('https://www.googleapis.com/auth/gmail.compose');
$cliente->setAccessToken(file_get_contents('token.conf'));
if ($cliente->getAccessToken()) {
    $service = new Google_Service_Gmail($cliente);
    try {
        $mail = new PHPMailer();
        $mail->CharSet = "UTF-8";
        $mail->From = $origen;
        $mail->FromName = $alias;
        $mail->AddAddress($destino);
        $mail->AddReplyTo($origen, $alias);
        $mail->Subject = $asunto;
        $mail->Body = $mensaje;
        $mail->preSend();
        $mime = $mail->getSentMIMEMessage();
        $mime = rtrim(strtr(base64_encode($mime), '+/', '-_'), '=');
        $mensaje = new Google_Service_Gmail_Message();
        $mensaje->setRaw($mime);
        $service->users_messages->send('me', $mensaje);
        echo "correo enviado correctamente";
    } catch (Exception $e) {
        echo "Algun error";
        print $e->getMessage();
    }
}
开发者ID:JuanManuelOlalla,项目名称:usuarios,代码行数:31,代码来源:enviar.php

示例10: sendMailCambioEmail

 static function sendMailCambioEmail($destinatario)
 {
     session_start();
     $secreto = sha1($destinatario . Constant::SEMILLA);
     $origen = "izvdavid@gmail.com";
     $alias = "David";
     $destino = $destinatario;
     $asunto = "Cambio de email.";
     $mensaje = "Cambiar el email:   https://gestiondeusuarios-izvdavid2015.c9users.io/php/viewemail.php?correo={$destinatario}&secreto={$secreto}";
     require_once 'MailGoogle/google/autoload.php';
     require_once 'MailGoogle/class.phpmailer.php';
     //las últimas versiones también vienen con autoload
     $cliente = new Google_Client();
     $cliente->setApplicationName(Constant::PRO1);
     $cliente->setClientId(Constant::CID1);
     $cliente->setClientSecret(Constant::CSE1);
     $cliente->setRedirectUri(Constant::URI1);
     $cliente->setScopes('https://www.googleapis.com/auth/gmail.compose');
     $cliente->setAccessToken(file_get_contents('../clases/MailGoogle/token.conf'));
     if ($cliente->getAccessToken()) {
         $service = new Google_Service_Gmail($cliente);
         try {
             $mail = new PHPMailer();
             $mail->CharSet = "UTF-8";
             $mail->From = $origen;
             $mail->FromName = $alias;
             $mail->AddAddress($destino);
             $mail->AddReplyTo($origen, $alias);
             $mail->Subject = $asunto;
             $mail->Body = $mensaje;
             $mail->preSend();
             $mime = $mail->getSentMIMEMessage();
             $mime = rtrim(strtr(base64_encode($mime), '+/', '-_'), '=');
             $mensaje = new Google_Service_Gmail_Message();
             $mensaje->setRaw($mime);
             $service->users_messages->send('me', $mensaje);
             echo "Correo enviado correctamente.";
         } catch (Exception $e) {
             print $e->getMessage();
             echo "Error en el envio de correo";
         }
     } else {
         echo "No conectado con Gmail.";
     }
 }
开发者ID:izvDavid2015,项目名称:GestionDeUsuarios,代码行数:45,代码来源:MailGoogle.php

示例11: buildMessage

 /**
  * @return string
  */
 private function buildMessage(array $from, array $to, $subject, $message, array $attachments = null)
 {
     $mail = new \PHPMailer();
     $mail->CharSet = "UTF-8";
     $mail->Encoding = "base64";
     //supply with your header info, body etc...
     $mail->Subject = "You've got mail!";
     $mail->setFrom($from['email'], @$from['name']);
     $mail->addAddress($to['email'], @$to['name']);
     foreach ($attachments as $att) {
         $mail->addAttachment($att['path'], @$att['name']);
     }
     $mail->isHTML(true);
     //Message is MANDATORY! So, I force it to a blank space if is empty.
     $message = !empty($message) ? $message : ' ';
     $mail->Subject = $subject;
     $mail->Body = $message;
     $mail->AltBody = strip_tags($message);
     //create the MIME Message
     $mail->preSend();
     $mime = $mail->getSentMIMEMessage();
     $mime = rtrim(strtr(base64_encode($mime), '+/', '-_'), '=');
     return $mime;
 }
开发者ID:bonaccorsop,项目名称:JambonOrders,代码行数:27,代码来源:GmailClient.php

示例12: pwg_send_mail_test

/**
 * Saves a copy of the mail if _data/tmp.
 *
 * @param boolean $success
 * @param PHPMailer $mail
 * @param array $args
 */
function pwg_send_mail_test($success, $mail, $args)
{
    global $conf, $user, $lang_info;
    $dir = PHPWG_ROOT_PATH . $conf['data_location'] . 'tmp';
    if (mkgetdir($dir, MKGETDIR_DEFAULT & ~MKGETDIR_DIE_ON_ERROR)) {
        $filename = $dir . '/mail.' . stripslashes($user['username']) . '.' . $lang_info['code'] . '-' . date('YmdHis') . ($success ? '' : '.ERROR');
        if ($args['content_format'] == 'text/plain') {
            $filename .= '.txt';
        } else {
            $filename .= '.html';
        }
        $file = fopen($filename, 'w+');
        if (!$success) {
            fwrite($file, "ERROR: " . $mail->ErrorInfo . "\n\n");
        }
        fwrite($file, $mail->getSentMIMEMessage());
        fclose($file);
    }
}
开发者ID:lcorbasson,项目名称:Piwigo,代码行数:26,代码来源:functions_mail.inc.php

示例13: SendByPHPMailer

 private function SendByPHPMailer()
 {
     $email = $this->config['email'];
     $mailer = new \PHPMailer();
     $mailer->From = $this->From;
     $mailer->FromName = $this->FromName;
     $mailer->Subject = $this->Subject;
     $mailer->Body = $this->Body;
     $mailer->CharSet = 'UTF-8';
     $mailer->msgHTML($mailer->Body);
     $mailer->IsHtml(true);
     $mailer->AddAddress($this->TO);
     if (empty($this->ReplyTo)) {
         $senderEmail = Form::getSenderEmail();
         $this->ReplyTo = empty($senderEmail) ? $this->From : $senderEmail;
         $this->ReplyToName = $this->FromName;
     }
     $mailer->AddReplyTo($this->ReplyTo, $this->ReplyToName);
     if (!empty($this->CC)) {
         $CCs = explode(',', $this->CC);
         foreach ($CCs as $c) {
             $mailer->AddCC($c);
         }
     }
     if (!empty($this->BCC)) {
         $BCCs = explode(',', $this->BCC);
         foreach ($BCCs as $b) {
             $mailer->AddBCC($b);
         }
     }
     $attachments = Form::getAttachments();
     //$this->addLog($attachments);
     if (is_array($attachments)) {
         foreach ($attachments as $f) {
             $mailer->AddAttachment($f['path'], basename($f['name']));
         }
     }
     $smtp = $this->config['smtp'];
     $isSMTP = $this->mailer == 'smtp' && !empty($smtp);
     if ($isSMTP) {
         $mailer->IsSMTP();
         $mailer->Host = $smtp['host'];
         $mailer->Username = $smtp['user'];
         $mailer->Password = $smtp['password'];
         $mailer->SMTPAuth = !empty($mailer->Password);
         $mailer->SMTPSecure = $smtp['security'];
         $mailer->Port = empty($smtp['port']) ? 25 : $smtp['port'];
         $mailer->SMTPDebug = empty($smtp['debug']) ? 0 : 2;
     }
     if ($isSMTP && $mailer->SMTPDebug > 0) {
         ob_start();
     }
     $this->isSent = $mailer->Send();
     if ($isSMTP && $mailer->SMTPDebug > 0) {
         $debug = ob_get_contents();
         ob_end_clean();
         $this->addLog($debug);
     }
     if (!$sent) {
         $this->sendError = $mailer->ErrorInfo;
     }
     $this->sentMIMEMessage = $mailer->getSentMIMEMessage();
     return $this->isSent;
 }
开发者ID:astridmanzo,项目名称:bluepolygon-site,代码行数:64,代码来源:form.lib.php

示例14: send

 public function send()
 {
     if (isset($_SESSION['client'])) {
         $util = new Google_Utils();
         require_once dirname(__FILE__) . '/../libraries/PHPMailer/class.phpmailer.php';
         $mail = new PHPMailer();
         $mail->ContentType = 'text/plain';
         $mail->CharSet = "UTF-8";
         $subject = $_POST['subject'];
         $msg = $_POST['body'];
         $from = $_SESSION['user']->email;
         $fname = $_SESSION['user']->name ? $_SESSION['user']->name : $_SESSION['user']->email;
         $mail->From = $from;
         $mail->FromName = $fname;
         $recipients = split(',', $_POST['mail']);
         foreach ($recipients as $value) {
             $mail->AddAddress($value);
         }
         $mail->AddReplyTo($from, $fname);
         $mail->Subject = $subject;
         $mail->Body = $msg;
         $validAttachments = array();
         foreach ($_FILES['attachments']['name'] as $index => $fileName) {
             $filePath = $_FILES['attachments']['tmp_name'][$index];
             if (is_uploaded_file($filePath)) {
                 $attachment = new stdClass();
                 $attachment->fileName = $fileName;
                 $attachment->filePath = $filePath;
                 $validAttachments[] = $attachment;
             }
         }
         foreach ($validAttachments as $attachment) {
             $mail->AddAttachment($attachment->filePath, $attachment->fileName);
         }
         $mail->preSend();
         $mime = $mail->getSentMIMEMessage();
         $message = new Google_Service_Gmail_Message();
         $raw = $util::urlSafeB64Encode($mime);
         $message->setRaw($raw);
         //Creamos una instancia de nuestro "modelo"
         $mailsModel = new MailsModel();
         $aux = $mailsModel->sendMessage($message);
         $this->helper->redirect('/mails/getAll/SENT');
     } else {
         $this->helper->redirect();
     }
 }
开发者ID:able-to-include,项目名称:email-client,代码行数:47,代码来源:mailsController.php

示例15: metodoregistro

 function metodoregistro($gestor)
 {
     $email = Request::post('email');
     $clave = Request::post('clave');
     $claveR = Request::post('claveR');
     $consulta = $gestor->get($email)->getEmail();
     if ($consulta != null) {
         $contenidoParticular = Plantilla::cargarPlantilla("../templates/_mensaje.html");
         $datos = array("mensaje" => "Error. Ya existe un artista para ese email", "ruta" => "../index.php?op=0");
         $contenidoParticular = Plantilla::sustituirDatos($datos, $contenidoParticular);
         $pagina = Plantilla::cargarPlantilla("../templates/_plantilla.1.html");
         $datos = array("contenidoParticular" => $contenidoParticular);
         echo Plantilla::sustituirDatos($datos, $pagina);
     } else {
         if ($clave === $claveR) {
             $nombreArtistico = $email;
             $claveCifrada = sha1($clave . Constant::SEMILLA);
             $artista = new Artista($email, $claveCifrada, $nombreArtistico, 1, 0);
             $gestor->insert($artista);
             $destino = $email;
             $sha1 = sha1($destino . Constant::SEMILLA);
             $origen = 'mmarjusticia@gmail.com';
             $asunto = "Validación";
             $mensaje = "Confirme su registro a la galería pulsando el siguiente enlace: " . "https://galeria-mmarjusticia.c9users.io/artista/index.php?op=activar&email={$destino}&sha1={$sha1}";
             require_once '../clases/Google/autoload.php';
             require_once '../clases/class.phpmailer.php';
             //las últimas versiones también vienen con autoload
             $cliente = new Google_Client();
             $cliente->setApplicationName('enviar');
             $cliente->setClientId("270220163093-pe1ci6joub5ai7k0dgtlloukg764pclj.apps.googleusercontent.com");
             $cliente->setClientSecret('U-cIahmOQjJkR4Iyl-A1oL6-');
             $cliente->setRedirectUri('https://galeria-mmarjusticia.c9users.io/oauth/guardar.php');
             $cliente->setScopes('https://www.googleapis.com/auth/gmail.compose');
             $cliente->setAccessToken(file_get_contents('../oauth/token.conf'));
             if ($cliente->getAccessToken()) {
                 $service = new Google_Service_Gmail($cliente);
                 try {
                     $mail = new PHPMailer();
                     $mail->CharSet = "UTF-8";
                     $mail->From = $origen;
                     $mail->FromName = $alias;
                     $mail->AddAddress($destino);
                     $mail->AddReplyTo($origen, $alias);
                     $mail->Subject = $asunto;
                     $mail->Body = $mensaje;
                     $mail->preSend();
                     $mime = $mail->getSentMIMEMessage();
                     $mime = rtrim(strtr(base64_encode($mime), '+/', '-_'), '=');
                     $mensaje = new Google_Service_Gmail_Message();
                     $mensaje->setRaw($mime);
                     $service->users_messages->send('me', $mensaje);
                     $contenidoParticular = Plantilla::cargarPlantilla("../templates/_mensaje.html");
                     $datos = array("mensaje" => "Para finalizar el registro,verifique su correo electronico y active su cuenta", "ruta" => "../index.php?op=0");
                     $contenidoParticular = Plantilla::sustituirDatos($datos, $contenidoParticular);
                     $pagina = Plantilla::cargarPlantilla("../templates/_plantilla.1.html");
                     $datos = array("contenidoParticular" => $contenidoParticular);
                     echo Plantilla::sustituirDatos($datos, $pagina);
                 } catch (Exception $e) {
                     print $e->getMessage();
                 }
             } else {
                 $contenidoParticular = Plantilla::cargarPlantilla("../templates/_mensaje.html");
                 $datos = array("mensaje" => "Ha ocurrido un error con la conexión, por favor repita el proceso", "ruta" => "../index.php?op=0");
                 $contenidoParticular = Plantilla::sustituirDatos($datos, $contenidoParticular);
                 $pagina = Plantilla::cargarPlantilla("../templates/_plantilla.1.html");
                 $datos = array("contenidoParticular" => $contenidoParticular);
                 echo Plantilla::sustituirDatos($datos, $pagina);
             }
         } else {
             $contenidoParticular = Plantilla::cargarPlantilla("../templates/_mensaje.html");
             $datos = array("mensaje" => "Error. Las contraseñas no coinciden", "ruta" => "../index.php?op=0");
             $contenidoParticular = Plantilla::sustituirDatos($datos, $contenidoParticular);
             $pagina = Plantilla::cargarPlantilla("../templates/_plantilla.1.html");
             $datos = array("contenidoParticular" => $contenidoParticular);
             echo Plantilla::sustituirDatos($datos, $pagina);
         }
     }
 }
开发者ID:mmarjusticia,项目名称:proyectoGaleria,代码行数:78,代码来源:ControladorArtista.php


注:本文中的PHPMailer::getSentMIMEMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。