Solved

cakeemail on remote server

Posted on 2015-01-02
5
96 Views
Last Modified: 2015-01-26
Hi,

I am having problems with cakephp email.
I have this weird problem where my below email code works fine on my local server but not on the remote server.

The error I get is
SMTP Error: 534 5.7.14 https://support.google.com/mail/bin/answer.py?answer=78754 u5sm29708221pdh.54 - gsmtp

which doesnt make any sense to me because my email does work from my local server, the google account has low security enabled already.

my email.php

  public $gmail2 = array(
    'host' => 'ssl://smtp.gmail.com',
     'port' => 465,
     'username' => 'xxxxx@gmail.com',
       'password' => 'xxxxxx',
    'transport' => 'Smtp',
 
);

in controller


 
 $Email = new CakeEmail();
                             $Email->config('gmail2');
                            // $to=$item['Tutor']['email'];
                             $to='xxxxxxx';
                             $Email->from( array('xxxxxx' => 'Aptutoring'));
                             $Email->to($to);
                             $Email->subject('Hello');
                             $Email->send($message);   //$message set elsewhere
0
Comment
Question by:jagguy
  • 3
  • 2
5 Comments
 
LVL 43

Expert Comment

by:Rob
ID: 40528958
That is a reply from the google's mail servers stating that the username or password is incorrect: https://support.google.com/mail/answer/78754

As it says in the article, it could also be the need for an App password: https://support.google.com/accounts/answer/185833

When you sign in from multiple locations and multiple times quickly as you may have been while testing on your production server, there's every chance that Google has blocked your server.
0
 

Author Comment

by:jagguy
ID: 40530753
I agree with your reply as I knew this already but how do I fix it?
An app password is for a phone and I am using PC's so why would this cause an issue and my password/login is correct.


Where to from here?
0
 

Accepted Solution

by:
jagguy earned 0 total points
ID: 40563468
The problem works now after I restrted the server
0
 
LVL 43

Expert Comment

by:Rob
ID: 40563481
Nothing like a restart to fix things *grin*
0
 

Author Closing Comment

by:jagguy
ID: 40570223
I solved it
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Calculating percentage 2 29
Prevent certain words from being typed in a form 6 28
JS to redirect to prev page 8 19
sort Multi-dimensional array 6 11
This article discusses how to create an extensible mechanism for linked drop downs.
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question