Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/10/2011, 10:55
cslbcn
 
Fecha de Ingreso: marzo-2008
Mensajes: 383
Antigüedad: 16 años, 1 mes
Puntos: 5
Enviar HTML por mail

Hola a todos.

Hasta ahora tenía que hacer mailings en HTML y enviarlos a ciertas direcciones de email a través de una una funcion aen php (phpmailing).

Ahora me surge la necesidad de enviar esos mismos mailings previamente traducidos al idioma del usuario a quién se le envia. Esa traducción se hace mediante archivos .mo. O sea, enviar una página .php por email... y aquí tengo el problema, que no se envía.

La página enviada (mailXXX.php) no se puede enviar al ser .php. Como puedo hacerlo?

Funcion PHP
Código PHP:
Ver original
  1. try {  
  2.    
  3.   $mail->Host       = "xxxxxx"; // SMTP server
  4.   $mail->SMTPDebug  = 2;                     // enables SMTP debug information (for testing)
  5.   $mail->SMTPAuth   = xxxxx;                  // enable SMTP authentication
  6.   $mail->Host       = "xxxxxx"; // sets the SMTP server
  7.   $mail->Port       = xxxxx;                    // set the SMTP port for the GMAIL server
  8.   $mail->Username   = "xxxxxxx"; // SMTP account username
  9.   $mail->Password   = "xxxxxx";        // SMTP account password
  10.   //$mail->AddReplyTo('[email protected]', 'First Last');
  11.   $mail->AddAddress('[email protected]', 'xxxx');
  12.   $mail->SetFrom('[email protected]', 'xxxx');
  13.   //$mail->AddReplyTo('[email protected]', 'First Last');
  14.   $mail->Subject = "Mailing";
  15.   $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically
  16.   $mail->MsgHTML(file_get_contents('mailXXX.php'));
  17.   //$mail->AddAttachment('images/phpmailer.gif');      // attachment
  18.   //$mail->AddAttachment('images/phpmailer_mini.gif'); // attachment
  19.   $mail->Send();
  20.  
  21.  
  22. } catch (phpmailerException $e) {
  23.   echo $e->errorMessage(); //Pretty error messages from PHPMailer
  24. } catch (Exception $e) {
  25.   echo $e->getMessage(); //Boring error messages from anything else!