Foros del Web » Programando para Internet » PHP » Configuración PHP »

enviar correos con phpmailer a gmail

Estas en el tema de enviar correos con phpmailer a gmail en el foro de Configuración PHP en Foros del Web. quiero hacer un formulario y enviar correos a gmail pero tengo estos dos enlaces y no se como hacerlo y que ficheros tengo que hacer ...
  #1 (permalink)  
Antiguo 17/12/2009, 07:18
 
Fecha de Ingreso: febrero-2009
Mensajes: 443
Antigüedad: 15 años, 2 meses
Puntos: 1
enviar correos con phpmailer a gmail

quiero hacer un formulario y enviar correos a gmail

pero tengo estos dos enlaces y no se como hacerlo y que ficheros tengo que hacer
tengo que modificar algo en el fichero class.phpmailer.php i el class.smtp.php y tambien tengo el ejemplo de advances exaple using gmail


http://phpmailer.worxware.com/index.php?pg=exampleagmail
http://sourceforge.net/projects/phpmailer/files/phpmailer%20for%20php5_6/

Advanced Example using Gmail
(for PHPMailer v5.0.0 and up)


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 = "tls"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 587; // 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\n";
} catch (phpmailerException $e) {
echo $e->errorMessage(); //Pretty error messages from PHPMailer
} catch (Exception $e) {
echo $e->getMessage(); //Boring error messages from anything else!
}
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Tema Cerrado




La zona horaria es GMT -6. Ahora son las 14:43.