Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 887
  • Last Modified:

cant send email in cakephp

Hi,

I cant send a email from my localhost xampp/win7
I dont get an error , I just get nothing

I set up the email and also config. I read the docs and couldnt see anything on this.

http://book.cakephp.org/2.0/en/core-utility-libraries/email.html

  $Email = new CakeEmail();
                    $Email->config('smtp')
             ->from('email@gmail.com')
           ->to('jagguy999@gmail.com')
             ->subject('Test')
             ->send($message);


      public $smtp = array(
    'transport' => 'Smtp',
    'from' => array('site@localhost' => 'My Site'),
    'host' => 'localhost',
    'port' => 25,
    'timeout' => 30,
    'username' => 'user',
    'password' => 'secret',
    'client' => null,
    'log' => false,
    //'charset' => 'utf-8',
    //'headerCharset' => 'utf-8',
);
0
jagguy
Asked:
jagguy
  • 3
  • 2
1 Solution
 
hulseboschCommented:
How did you configure the smtp settings?

class EmailConfig {
    public $gmail = array(
        'host' => 'smtp.gmail.com',
        'port' => 465,
        'username' => 'my@gmail.com',
        'password' => 'secret',
        'transport' => 'Smtp',
        'tls' => true
    );
}
0
 
jagguyAuthor Commented:
Hi,

Please if your going to reply with some code that I am having problems with then can you explain this better.
I already gave an example of this file in app/Config/email.php and you gave another example of a file which the docs say isnt required. Can you see how I am not getting anywhere?

    public $smtp = array(
    'transport' => 'Smtp',
    'from' => array('site@localhost' => 'My Site'),
    'host' => 'localhost',
    'port' => 25,
    'timeout' => 30,
    'username' => 'user',
    'password' => 'secret',
    'client' => null,
    'log' => false,
    //'charset' => 'utf-8',
    //'headerCharset' => 'utf-8',
);

It is not required to create app/Config/email.php, CakeEmail can be used without it and use respective methods to set all configurations separately or load an array of configs.
0
 
jagguyAuthor Commented:
This isnt working and I need help as I cant fund help from the docs.
I set up the settings and in the config file I have


public $gmail = array(
    'from' => array('jagguy999@gmail.com' => 'Aptutoring'),      
    'host' => 'localhost',
        'port' => 25,
        'username' => 'my@gmail.com',  //I changed the name but he email/password is real gmail account
        'password' => 'test',
       // 'transport' => 'Smtp'
    );
   
    public $smtp = array(
    'transport' => 'Smtp',
   // 'from' => array('site@localhost' => 'My Site'),
       'from' => array('jagguy999@gmail.com' => 'My Site'),      
    'host' => 'localhost',
    'port' => 25,
    'timeout' => 30,
    'username' => 'user',
    'password' => 'secret',
    'client' => null,
    'log' => false,
    //'charset' => 'utf-8',
    //'headerCharset' => 'utf-8',
);


No connection could be made because the target machine actively refused it.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
hulseboschCommented:
Jagguy,

PHP has, nore is an smtp server of its own.
Therefore you will need to present one, as in the sample I presented to you.

Please note, that Gmail is just a sample of which I am pretty sure will not work as well.
You can try this setting, using the smtp settings from your own provider.

  'host' => 'localhost', will not send out your mail.
0
 
RobOwner (Aidellio)Commented:
Do you have an email server setup?  You are using localhost, meaning you are trying to send an email using your webserver.

try using smtp.gmail.com instead of localhost
0
 
jagguyAuthor Commented:
I dont need to email just yet  it seems so I dont need the question
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now