Ver Mensaje Individual
  #5 (permalink)  
Antiguo 03/01/2012, 18:54
Avatar de emprear
emprear
Colaborador
 
Fecha de Ingreso: junio-2007
Ubicación: me mudé
Mensajes: 8.388
Antigüedad: 16 años, 10 meses
Puntos: 1567
Respuesta: Enviar un hipervinculo con PHPMailer

phpmailer tiene una opción para enviar texto alternativo como text/plain para el caso de que el cliente de correo esté configurado para recibir texto plano solamente


Código PHP:
Ver original
  1. <?php
  2. require_once '../class.phpmailer.php';
  3.  
  4. $mail = new PHPMailer(true); //defaults to using php "mail()"; the true param means it will throw exceptions on errors, which we need to catch
  5.  
  6. try {
  7.   $mail->AddReplyTo('[email protected]', 'First Last');
  8.   $mail->AddAddress('[email protected]', 'John Doe');
  9.   $mail->SetFrom('[email protected]', 'First Last');
  10.   $mail->AddReplyTo('[email protected]', 'First Last');
  11.   $mail->Subject = 'PHPMailer Test Subject via mail(), advanced';
  12.   $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically
  13.   $mail->MsgHTML(file_get_contents('contents.html'));
  14.   $mail->AddAttachment('images/phpmailer.gif');      // attachment
  15.   $mail->AddAttachment('images/phpmailer_mini.gif'); // attachment
  16.   $mail->Send();
  17.   echo "Message Sent OK</p>\n";
  18. } catch (phpmailerException $e) {
  19.   echo $e->errorMessage(); //Pretty error messages from PHPMailer
  20. } catch (Exception $e) {
  21.   echo $e->getMessage(); //Boring error messages from anything else!
  22. }
  23. ?>


si te fijas aparte de enviar el contenido de un html utiliza AltBody para enviar texto plano


Código PHP:
Ver original
  1. $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically
  2.   $mail->MsgHTML(file_get_contents('contents.html'));
  3.  
  4. Saludos

Saludos
__________________
La voz de las antenas va, sustituyendo a Dios.
Cuando finalice la mutación, nueva edad media habrá
S.R.