Solved

cant send email again

Posted on 2014-12-28
9
97 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
Comment Utility
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 76

Expert Comment

by:arnold
Comment Utility
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 24

Expert Comment

by:lenamtl
Comment Utility
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
 

Author Comment

by:jagguy
Comment Utility
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 76

Expert Comment

by:arnold
Comment Utility
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 42

Expert Comment

by:Rob Jurd, EE MVE
Comment Utility
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
Comment Utility
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
Comment Utility
i found the answer
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Envision that you are chipping away at another e-business site with a team of pundit developers and designers. Everything seems, by all accounts, to be going easily.
This article discusses four methods for overlaying images in a container on a web page
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…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…

744 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now