0

Ok I've been knocking my head against a wall, more for the overall problem of send an email thru PHP while specifying a mail server...

The solution I've made it the furthest with is phpmailer. If there is a lightweight VERY easy solution - please suggest it.

here's what I have (obviously the u/p are NOT the real u/p - but they are in my code - the same account I get my gmail from in outlook, settings work FINE there...

Im using it as a test - because the smtp settings the client gave me didn't work - so I though I'd try something that I KNEW - DID work...

<?php
require 'phpmailer/class.phpmailer.php';

$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 2;
$mail->Debugoutput = 'html';
$mail->Host = "smtp.gmail.com";
$mail->Port = 465;
$mail->SMTPAuth = true;
$mail->Username = "me@myDomain.com";
$mail->Password = "myPassword";
$mail->SetFrom('me@myDomain.com', 'James Test');
$mail->AddAddress('me@yahoo.com', 'John Doe');
$mail->Subject = 'PHPMailer SMTP test';
$mail->MsgHTML( 'This is a test' );

//Send the message, check for errors
if( !$mail -> Send() ) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
?>

The error I'm getting

SMTP -> FROM SERVER:
CLIENT -> SMTP: EHLO dev.nps.com
SMTP -> FROM SERVER:
SMTP -> ERROR: EHLO not accepted from server:
CLIENT -> SMTP: HELO dev.nps.com
SMTP -> FROM SERVER:
SMTP -> ERROR: HELO not accepted from server:
CLIENT -> SMTP: AUTH LOGIN
SMTP -> ERROR: AUTH not accepted from server:
SMTP -> NOTICE: EOF caught while checking if connected
The following From address failed: me@myDomain.com : Called Mail() without being connected
Mailer Error: The following From address failed: me@myDomain.com : Called Mail() without being connected

The dev.nps.com is simply a 'fake' domain I put in my host file, so i can distinguish my projects and not use 127.0.0.1 for everything... it's not specified in the code - so I'm not sure what's going on there, but the error seems to balk at the 'from email'... which again is weird because it shouldn't matter

Thanks for any help -

Yogesh Suthar
  • 30,424
  • 18
  • 72
  • 100
j-p
  • 3,698
  • 9
  • 50
  • 93
  • have you seen http://stackoverflow.com/questions/5757593/problem-with-smtp-emails-sent-via-phpmailer-helo-not-accepted – Nicholas King May 10 '13 at 10:12
  • and also http://stackoverflow.com/questions/3618712/sending-emails-through-smtp-with-phpmailer – Nicholas King May 10 '13 at 10:14
  • Nicholas - thx for the links - in the first one the solution is a port number and the second articles solution is authentication.... If Im missing something about gmail auth - that is a possibility, but I can't stress enough that these very setting WORK in my mail client AND on my coldfsuion server to send mail. the ONLY difference on the u/p and server/port are the fact that Im using PHPmailer .. from the SAME box (either my laptop for dev OR my co-lo server)... so i have a hard time believing it's a gmail auth issue. – j-p May 10 '13 at 14:52
  • it may not be a gmail issue it may be a phpmailer issue in that it needs either $mail->SMTPSecure = 'tls'; or $mail->SMTPSecure = 'ssl'; to be set – Nicholas King May 10 '13 at 14:55
  • God bless you Nicholas - $mail->SMTPSecure = 'ssl'; - works beautifully!!!!!!!!!!!!!!!! – j-p May 10 '13 at 23:19

0 Answers0