[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

cant send email again

Posted on 2014-12-28
9
Medium Priority
?
121 Views
Last Modified: 2015-01-04
Hi,

I thought I solved this problem before but I cant send an email as I get a generic error
Error: An Internal Error Has Occurred.
I am using cakeEmail for cakephp

In config\email.php I have this for a real gmail account(pswd hidden)
 
          public $gmail = array(
        'host' => 'smtp.gmail.com',
        'port' => 465,
         'username' => 'jagguy999@gmail.com',
       'password' => 'XXXXX',
        'transport' => 'Smtp',
        'tls' => true
    );

in controller I have


App::uses('CakeEmail', 'Network/Email');

 public $components = array('Email','Session','Paginator');
 
public function test() {
   
     $Email = new CakeEmail();
$Email->from(array('jagguy999@gmail.com' => 'My Site'));
$Email->to('jagguy999@gmail.com');
$Email->subject('About');
$Email->send('My message');
   
   
 }
0
Comment
Question by:jagguy
8 Comments
 

Author Comment

by:jagguy
ID: 40521439
Not a chance sorry.
I am using cakephp and this is not php.

I cant get this to work at all
http://book.cakephp.org/2.0/en/core-utility-libraries/email.html
0
 
LVL 81

Expert Comment

by:arnold
ID: 40522408
The simplest test if you have access to the terminal on the affected system is to try and connect manually out to mail.gmail.com 465 and see where the error is coming from.

IMHO, it is best to use the local mail install to send email out through.  That server should be configured to either deliver the messages itself or relay it through the local ISP.  You're setup is that you are trying to connect through an external provider where network issues, or their implementation of a block because they received complaints and blacklisted the IP of your system or locked out your account.

the terminal example is:
openssl s_client -connect mail.gmail.com:465 smtp

you would need to encode the username/password in a base64 in order to authenticate and be in a position to further diagnose this issue.

Since your code was working, it should continue to work.
0
 
LVL 27

Expert Comment

by:lenamtl
ID: 40522417
Hi you have to change the settings to allow less security apps and enable application to access gmail account.


1. Login into your gmail account (the one you are using with your code)

2.  Enable access to less security apps

For more info https://support.google.com/accounts/answer/6010255?hl=en
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:jagguy
ID: 40522657
Yes I have allow less security apps and enable application to access gmail account but it has NO effect.

Not sure about the testing manually but my code is standard so I have not a clue in what to do.
0
 
LVL 81

Expert Comment

by:arnold
ID: 40522696
Double check that gmail.com did not block your IP from being able send through them, or disabled the account you are using to send emails out.

Does the server where your PHP code reside, have their own email server component installed?  Use it instead i.e. localhost no username, no password on port 25 and see if your emails are going out to a non-gmail email address.

Between the code you have on the web page and the receipt of the email in the inbox, there is a vast range of possible explanations on what might be going on.

was the server on which your PHP code runs, been upgraded ....
the rest deals with verifying that the communications from this server to GMAIL is not being blocked by gmail.

Based on the information you are providing, there is no way for me to know which is the cause of your issue.  What was the resolution to your prior similar situations?
0
 
LVL 43

Expert Comment

by:Rob
ID: 40522820
The DebugKit I've found to be very helpful with what's going on server side as well: https://github.com/cakephp/debug_kit

It gives you up to date and easily accessible information regarding your session variables, errors, and other relevant data to your Cake application so it could quite easily show you something regarding the email issues.
0
 

Accepted Solution

by:
jagguy earned 0 total points
ID: 40524618
Ok I used ssl and this worked as is

   public $gmail2 = array(
 
    'host' => 'ssl://smtp.gmail.com',
 
    'port' => 465,
   'username' => 'jxxxm',
       'password' => 'jxxxx',
    'transport' => 'Smtp',

);
0
 

Author Closing Comment

by:jagguy
ID: 40529998
i found the answer
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses
Course of the Month19 days, 23 hours left to enroll

872 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