Ver Mensaje Individual
  #6 (permalink)  
Antiguo 21/12/2012, 09:01
Avatar de rodno
rodno
 
Fecha de Ingreso: enero-2009
Ubicación: En algun lugar de Cuba
Mensajes: 426
Antigüedad: 15 años, 3 meses
Puntos: 43
Respuesta: /Consulta/ PHP Mailer y FROM

Buenas,

buscando en mis cosas encontre un ejemplo que viene con PHPMailer 5.21, te lo estoy copiando literalmente como esta:

Código PHP:
<html>
<head>
<title>PHPMailer - SMTP (Gmail) advanced test</title>
</head>
<body>

<?php
require_once('../class.phpmailer.php');
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded

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

$mail->IsSMTP(); // telling the class to use SMTP

try {
  
$mail->Host       "mail.yourdomain.com"// SMTP server
  
$mail->SMTPDebug  2;                     // enables SMTP debug information (for testing)
  
$mail->SMTPAuth   true;                  // enable SMTP authentication
  
$mail->SMTPSecure "ssl";                 // sets the prefix to the servier
  
$mail->Host       "smtp.gmail.com";      // sets GMAIL as the SMTP server
  
$mail->Port       465;                   // set the SMTP port for the GMAIL server
  
$mail->Username   "[email protected]";  // GMAIL username
  
$mail->Password   "yourpassword";            // GMAIL password
  
$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</p>\n";
} catch (
phpmailerException $e) {
  echo 
$e->errorMessage(); //Pretty error messages from PHPMailer
} catch (Exception $e) {
  echo 
$e->getMessage(); //Boring error messages from anything else!
}
?>

</body>
</html>
dime si ya lo habias adaptado a tus necesidades y probado, sino , trata de probar

Saludos
__________________
"No te preocupes si no funciona bien. Si todo lo hiciera, no tendrías trabajo."
"El problema no es no saber, sino no saber quién sabe"
..::Con Karma se piensa mejor::..