Here is my code:
require_once("PHPMailer/class.phpmailer.php");
$mail = new PHPMailer();
// set authentication
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->SMTPSecure = "tls";
$mail->Host = "smtp.gmail.com";
$mail->Post = 587;
$mail->Username = "myemail@gmail";
$mail->Password = "myemailpassword";
// set From:
$mail->SetFrom("myemail@gmail.com", "First Last");
// set To:
$mail->AddAddress("adifferentemail@yahoo.com", "First Last");
// set Subject:
$mail->Subject = "Subject";
// set body
$mail->IsHTML(true);
$mail->Body = "<html>
<body>
<p>Body Text</p>
</body>
</html>";
$mail->AltBody = "Sorry, your email client does not support HTML messages.";
// send mail
if (!$mail->Send())
die($mail->ErrorInfo . "\n");
I've tried changing from TLS to SSL, I've tried it with and without authentication, with SMTPSend() instead of just Send(), but I always get the "The following From address failed: myemail@gmail.com : Called Mail() without being connected" error. Any ideas where this might be coming from? I'm really new at this, so it's probably something pretty obvious...