El código que estoy usando es este:
Código PHP:
<?php
require_once 'class.phpmailer.php';
$mail = new PHPMailer ();
$mail -> From = "[email protected]";
$mail -> FromName = "mi-nombre";
$mail -> AddAddress ("email-destino");
$mail -> Subject = "Test";
$mail -> Body = "<h3>From GMail!</h3>";
$mail -> IsHTML (true);
$mail->IsSMTP();
$mail->Host = 'ssl://smtp.gmail.com';
$mail->Port = 465;
$mail->SMTPAuth = true;
$mail->Username = '[email protected]';
$mail->Password = 'contraseña';
if(!$mail->Send()) {
echo 'Error: ' . $mail->ErrorInfo;
}
else {
{ echo 'Mail enviado!'.
}
?>