PHP on GoDaddy Linux Shared trying to send through GMAIL SMTP
As discussed previously, GoDaddy has been known to block outgoing SSL SMTP connections in favor of forcing you to use their own outgoing mail server.
This is pretty much the tip of the iceberg, with regard to the immense suckitude of GoDaddy as a company, registrar and web host. Ditch'em.
I had the same problem, and after going through different sites, I found this one and it actually worked!
GoDaddy does allow to send emails using Gmail as your SMTP, just need to get rid of the smtp.gmail.com and use their Host instead. This is my setup:
$mail = new PHPMailer();
$mail->isSMTP();
$mail->Host = "relay-hosting.secureserver.net";
$mail->Username = "[email protected]";
$mail->Password = "yourpassword";
// ...
// send from, send to, body, etc...
Reference (see first two posts) http://support.godaddy.com/groups/web-hosting/forum/topic/phpmailer-with-godaddy-smtp-email-server-script-working/
I finally fixed this putting a comment on the //$mail->isSMTP();
line. After that my Gmail account started working fine in Godaddy.
require 'PHPMailer/class.phpmailer.php';
require 'PHPMailer/PHPMailerAutoload.php';
$mail = new PHPMailer;
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$subject = 'Your subject';
$body = "From: $name\n E-Mail: $email\n Comments:\n $message";
//$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = '[email protected]';
$mail->Password = 'xxxxxxxxx';
$mail->SMTPSecure = 'tls';
$mail->Port =587;