Tengo en google cuentas de una empresa, pero necesito hacer un formulario de contactos en una pagina estoy intentando hacer pruebas y no me jala el phpmailer;
SMTP -> FROM SERVER:220 mx.google.com ESMTP w22sm4255424wfd.19
SMTP -> FROM SERVER: 250-mx.google.com at your service, [189.129.67.31] 250-SIZE 35651584 250-8BITMIME 250-STARTTLS 250 ENHANCEDSTATUSCODES
SMTP -> FROM SERVER:220 2.0.0 Ready to start TLS
Warning: stream_socket_enable_crypto() [streams.crypto]: this stream does not support SSL/crypto in C:\AppServ\www\pruebas\class.smtp.php on line 197
ya habilite el ssl en php.ini y cambie de puerto $SMTP = 587; en class.smtp.php..
ya no se que mas hacer el codigo que tengo es este;
Código PHP:
<html>
<head>
<title>PHPMailer - SMTP (Gmail) advanced test</title>
</head>
<body>
<?php
require_once('../class.phpmailer.php');
//include("pruebas/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.gmail.com"; // SMTP server -------------< he pues otro host y me sale lo mismo
$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 = "******@****cado.com.mx"; // GMAIL username
$mail->Password = "******"; // GMAIL password
$mail->AddReplyTo('******@****cado.com.mx', '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>