I have a PHP page that uses PEAR Mail to send a message through a Google Apps mail account. The page is only active in autumn and winter, and it works fine when it was used in January.
Now, when I create a site for the fall, this page no longer works. I have the same problem as described in SMTP Error 535 (invalid authentication data) using PEAR mail . There were no answers to this question, and this will not allow me to comment, so I am starting a new question.
I use a code identical to the one sent by pavan kumar to Send an email using the GMail SMTP server from the PHP page .
Error message:
authentication failure [SMTP: Invalid response code received from server (code: 535, response: Incorrect authentication data)]
I double-checked that the login for the mail user has not been changed since January. I copied and pasted the address and password from my script into the Gmail login in my browser. This worked, so I know my settings are correct. This account is the business domain address, not @ gmail.com.
I am trying to connect at:
$host = "ssl://smtp.gmail.com"; $port = "465";
I also tried to specify tls: // and port 587, no luck. I also set the host to “googlemail.com” instead of “gmail.com” to offer in another SO thread.
I made the var_dump () of the $ smtp object and confirmed that my address and password were successfully transferred and successfully executed.
The account is located on cPanel, recently upgraded to PHP 5.3.5 and Apache 2.2.22. It seems unlikely that the change could cause this problem, but I mention this in case this could be a factor.
Edit: found http://support.google.com/a/bin/answer.py?hl=en&answer=176600 saying: "... you must configure the SPF record for your domain with the IP address of the device or application to ensure that recipients do not reject mail sent from it, you must also add this IP address to the Email Whitelist field in the Google Apps control panel. For example, if your sending device sends from 123.45.67.89, add this the address of your SPF record without deleting the Google Apps mail servers from the record ... "Unfortunately, I don’t have a Whitelist field in this m domain is a free user account that obviously does not have this feature.
Edit 2: Related: http://support.google.com/mail/bin/answer.py?hl=en&answer=78775
Edit 3: I set up an Opera mail account and successfully sent it using the AUTH LOGIN and AUTH PLAIN settings.