class.phpmailer.php works on one server and not the other

We are migrating from one server to another and on our live site we have a page that calls the class.phpmailer.php and sends email just fine.

But on the new server it keeps failing.

I am pretty sure it is a server setting (maybe a port) or a configuration setting that might be causing this.

Can anyone point me in the right direction?

Thank you
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
it keeps failing
How do you know this?  Please share the symptoms in detail so we can begin to get an understanding, thanks.
Razzmataz73Author Commented:
When the form is submitted on our live server it is fine.

But on our test server it fails to send.

I just added the $mail->SMTPDebug = 1; and echo "<br>Mailer Error: " . $mail->ErrorInfo; code, and got this (the passwords are correct though):

SMTP -> ERROR: Password not accepted from server: 534-5.7.14 Please log in via your web browser and then try again. 534-5.7.14 Learn more at 534 5.7.14 54 uo1sm27389088vec.6 - gsmtp Failed to send mail

Mailer Error: SMTP Error: Could not connect to SMTP host.
Razzmataz73Author Commented:
I found this thread:

And followed the suggestion to comment out:
// $mail->IsSMTP();

And it worked.

Does that mean something should be tweaked on the newer server?
Or is it just one of those things and it needs to be a little different on the new server so I should just leave it commented out?
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Razzmataz73Author Commented:
Never mind,
That comment out just caused it to not use gmail.

I put up a test page at:

That calls the code:
// example on using PHPMailer with GMAIL

include("class.smtp.php"); // note, this is optional - gets called from main class if not already loaded

$mail             = new PHPMailer();

$body             = "This is a Test";

$mail->SMTPAuth   = true;                  // enable SMTP authentication
$mail->SMTPSecure = "ssl";                 // sets the prefix to the servier
$mail->Host       = "";      // sets GMAIL as the SMTP server
$mail->Port       = 465;                   // set the SMTP port

$mail->Username   = "";  // GMAIL username
$mail->Password   = "badabing33";            // GMAIL password

$mail->From       = "";
$mail->FromName   = "Webmaster";
$mail->Subject    = "This is the subject";
$mail->AltBody    = "This is the body when user views in plain text format"; //Text Body
$mail->WordWrap   = 50; // set word wrap



$mail->AddAttachment("/path/to/");             // attachment
$mail->AddAttachment("/path/to/image.jpg", "new.jpg"); // attachment

$mail->AddAddress("","First Last");

$mail->IsHTML(true); // send as HTML

if(!$mail->Send()) {
  echo "Mailer Error: " . $mail->ErrorInfo;
} else {
  echo "Message has been sent";

Open in new window

And gives you the error page message:
Mailer Error: The following From address failed: : MAIL not accepted from server,530,5.5.1 Authentication Required. Learn more at 530 5.5.1 z4sm28305882vdj.6 - gsmtp
SMTP server error: 5.5.1 Authentication Required. Learn more at 530 5.5.1 z4sm28305882vdj.6 - gsmtp

SMTP server error: 5.5.1 Authentication Required. Learn more at 530 5.5.1 z4sm28305882vdj.6 - gsmtp
Razzmataz73Author Commented:
I grabbed that (the classes and code) right from:
Dave BaldwinFixer of ProblemsCommented:
I don't think you can use '' as the from address because it's not a Gmail address.  I think you need to use ''.  I have PHPMailer_5.2.2 and I just downloaded 5.2.4 and both work on this computer.  What server is it failing on?  Apache?  IIS?
Razzmataz73Author Commented:
We figured it out.
This worked:

How do I close/rate this ticket?
I really appreciate you guys taking the time to take a look and want to make sure you get some credit.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Razzmataz73Author Commented:
Found the solution online
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.