Solved

cant send email again

Posted on 2014-12-28
9
102 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
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 77

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
The New “Normal” in Modern Enterprise Operations

DevOps for the modern enterprise offers many benefits — increased agility, productivity, and more, but digital transformation isn’t easy, especially if you’re not addressing the right issues. Register for the webinar to dive into the “new normal” for enterprise modern ops.

 

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 77

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

The New “Normal” in Modern Enterprise Operations

DevOps for the modern enterprise offers many benefits — increased agility, productivity, and more, but digital transformation isn’t easy, especially if you’re not addressing the right issues. Register for the webinar to dive into the “new normal” for enterprise modern ops.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
I am having a  Git   issue 6 42
youtube blocking politics 4 55
PHP Echo with auto submit 8 28
Make a website not indexable by google 6 12
This article discusses how to create an extensible mechanism for linked drop downs.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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.
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…

839 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