?
Solved

cant send email again

Posted on 2014-12-28
9
Medium Priority
?
115 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 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 79

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 26

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
Tutorial: Introduction to Managing a Linux Server

In this tutorial on systemd, we will explore:
-OS/Distro Adoption
-chkconfig and Other Legacy Commands
-Summary and Key Commands

 

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 79

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

Is Your Team Achieving Their Full Potential?

74% of employees feel they are not achieving their full potential. With Linux Academy, not only will you strengthen your team's core competencies but also their knowledge of of the newest IT topics.

With new material every week, we'll make sure that you stay ahead of the game.

Question has a verified solution.

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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Suggested Courses

764 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