Ver Mensaje Individual
  #2 (permalink)  
Antiguo 15/06/2009, 11:40
Avatar de Synkronice
Synkronice
 
Fecha de Ingreso: octubre-2007
Ubicación: Madrid
Mensajes: 831
Antigüedad: 16 años, 6 meses
Puntos: 48
Respuesta: email con xajax 2 parte

Para enviar un correo en formato HTML con PHPMailer() debes usar el método MsgHTML().

Ejemplo (obtenido de la web oficial)

Código PHP:
require_once '../class.phpmailer.php';

$mail = new PHPMailer(true); //defaults to using php "mail()"; the true param means it will throw exceptions on errors, which we need to catch

try {
  
$mail->AddReplyTo('[email protected]''First Last');
  
$mail->AddAddress('[email protected]''John Doe');
  
$mail->SetFrom('[email protected]''First Last');
  
$mail->AddReplyTo('[email protected]''First Last');
  
$mail->Subject 'PHPMailer Test Subject via mail(), advanced';
  
$mail->AltBody 'To view the message, please use an HTML compatible email viewer!'// optional - MsgHTML will create an alternate automatically
  
$mail->MsgHTML(file_get_contents('contents.html'));
  
$mail->AddAttachment('images/phpmailer.gif');      // attachment
  
$mail->AddAttachment('images/phpmailer_mini.gif'); // attachment
  
$mail->Send();
  echo 
"Message Sent OK\n";
} catch (
phpmailerException $e) {
  echo 
$e->errorMessage(); //Pretty error messages from PHPMailer
} catch (Exception $e) {
  echo 
$e->getMessage(); //Boring error messages from anything else!