# Original
if(strstr($hosts[$index], ":"))
list($host, $port) = explode(":", $hosts[$index]);
else
{
$host = $hosts[$index];
$port = $this->Port;
}
# Modificar
if (preg_match('#(([a-z]+://)?[^:]+):(\d+)#i', $hosts[$index], $match))
{
$host = $match[1];
$port = $match[3];
}
else
{
$host = $hosts[$index];
$port = $this->Port;
}
Página de Teste:
require_once 'class.phpmailer.php';
$mail = new PHPMailer ();
$mail -> From = "seu_email@gmail.com";
$mail -> FromName = "Seu Nome";
$mail -> AddAddress ("para_alguem@domain.com");
$mail -> Subject = "Email usando SMTP do Google";
$mail -> Body = "
Email enviado do Gmail.
";$mail -> IsHTML (true);
$mail -> IsSMTP();
$mail -> Host = 'ssl://smtp.gmail.com';
$mail -> Port = 465;
$mail -> SMTPAuth = true;
$mail -> Username = 'seu_email@gmail.com';
$mail -> Password = 'sua_senha';
if(!$mail->Send()) {
echo 'Erro:'.$mail->ErrorInfo;
} else {
echo 'Email enviado!';
}
?>
Nota: Para funcionar é necessário que a estensão OpenSSL do PHP esteja habilitada.
Att,
Orides Tomkiel
www.midiaville.com.br
fonte: http://forum.imasters.com.br/topic/265222-usando-o-smtp-do-google-com-o-phpmailer/