Solved

cant send email again

Posted on 2014-12-28
9
104 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 78

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 25

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
Why You Need a DevOps Toolchain

IT needs to deliver services with more agility and velocity. IT must roll out application features and innovations faster to keep up with customer demands, which is where a DevOps toolchain steps in. View the infographic to see why you need a DevOps toolchain.

 

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 78

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

739 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