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
Razzmataz73Asked:
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.
0
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 https://support.google.com/mail/bin/answer.py?answer=787 534 5.7.14 54 uo1sm27389088vec.6 - gsmtp Failed to send mail


Mailer Error: SMTP Error: Could not connect to SMTP host.
0
Razzmataz73Author Commented:
I found this thread:
http://stackoverflow.com/questions/11410429/error-send-email-with-phpmailer-in-server-domain-but-succed-in-localhost

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?
0
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:
http://www.visailing.com/gail/PHPMailer_5.2.4/emailtest.php

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

include("class.phpmailer.php");
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->IsSMTP();
$mail->SMTPAuth   = true;                  // enable SMTP authentication
$mail->SMTPSecure = "ssl";                 // sets the prefix to the servier
$mail->Host       = "smtp.gmail.com";      // sets GMAIL as the SMTP server
$mail->Port       = 465;                   // set the SMTP port

$mail->Username   = "heather.visailing@gmail.com";  // GMAIL username
$mail->Password   = "badabing33";            // GMAIL password

$mail->From       = "Heather@visailing.com";
$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->MsgHTML($body);

$mail->AddReplyTo("Heather@visailing.com","Webmaster");

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

$mail->AddAddress("heather.bartolotta@gmail.com","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: Heather@visailing.com : MAIL not accepted from server,530,5.5.1 Authentication Required. Learn more at 530 5.5.1 http://support.google.com/mail/bin/answer.py?answer=14257 z4sm28305882vdj.6 - gsmtp
SMTP server error: 5.5.1 Authentication Required. Learn more at 530 5.5.1 http://support.google.com/mail/bin/answer.py?answer=14257 z4sm28305882vdj.6 - gsmtp

SMTP server error: 5.5.1 Authentication Required. Learn more at 530 5.5.1 http://support.google.com/mail/bin/answer.py?answer=14257 z4sm28305882vdj.6 - gsmtp
0
Razzmataz73Author Commented:
I grabbed that (the classes and code) right from:
https://code.google.com/a/apache-extras.org/p/phpmailer/downloads/list
0
Dave BaldwinFixer of ProblemsCommented:
I don't think you can use 'Heather@visailing.com' as the from address because it's not a Gmail address.  I think you need to use 'heather.visailing@gmail.com'.  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?
0
Razzmataz73Author Commented:
We figured it out.
This worked:
http://www.rocketideas.com/2012/05/gmail-error-password-not-accepted-from-server-solved/

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.
0

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
0
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
PHP

From novice to tech pro — start learning today.