no se si es posible poner mas de un puerto en $mail->Port = 465;
supongo que tendría que poner estos para asegurarme que funciona correctamente alguien lo ha probado lo digo porque a hora solo funciona de gmail a gmail pero no quiero discriminar si ha gente que utiliza yahoo o hotmail
Hotmail Incoming Mail Server (POP3) - pop3.live.com (logon using Secure Password Authentification - SPA, mail server port: 995)
Hotmail Outgoing Mail Server (SMTP) - smtp.live.com (SSL enabled, port 25)
Yahoo Incoming Mail Server (POP3) - pop.mail.yahoo.com (port 110)
Yahoo Outgoing Mail Server (SMTP) - smtp.mail.yahoo.com (port 25)
Yahoo Plus Incoming Mail Server (POP3) - plus.pop.mail.yahoo.com (SSL enabled, port 995)
Yahoo Plus Outgoing Mail Server (SMTP) - plus.smtp.mail.yahoo.com (SSL enabled, port 465, use authentication)
Google Gmail Incoming Mail Server (POP3) - pop.gmail.com (SSL enabled, port 995)
Outgoing Mail Server - use the SMTP mail server address provided by your local ISP or smtp.gmail.com (SSL enabled, port 465)
MSN Incoming Mail Server (POP3) - pop3.email.msn.com (port 110, using Secure Password Authentication - SPA)
MSN Outgoing Mail Server - smtp.email.msn.com (select "My outgoing server requires authentication")
Código PHP:
<?php
include("class.phpmailer.php");
//include("class.smtp.php");
$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 = "localhost"; // 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 = "****************"; // GMAIL password
//$mail->AddReplyTo('[email protected]', 'First Last');
$mail->AddAddress(strtolower($_POST['correo']),strtolower($_POST['nombre']) );
$mail->SetFrom('[email protected]', 'negocio');
//$mail->AddReplyTo('[email protected]', 'First Last');//remitent
$mail->Subject=("negocio ".strtolower($_POST['asunto']));
$mail->MsgHTML(strtolower($_POST['mensaje']));
$mail->Send();
echo "<span class='correcto'><h2>Mensaje enviadao correctamente</h2></span>\n";
} catch (phpmailerException $e) {
echo $e->errorMessage(); //Pretty error messages from PHPMailer
} catch (Exception $e) {
echo $e->getMessage(); //Boring error messages from anything else!
}
?>
</html>