?
Solved

cant send email in cakephp

Posted on 2014-12-18
6
Medium Priority
?
830 Views
Last Modified: 2014-12-28
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
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
  • 3
  • 2
6 Comments
 
LVL 4

Accepted Solution

by:
hulsebosch earned 2000 total points
ID: 40507030
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
 

Author Comment

by:jagguy
ID: 40508005
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
 

Author Comment

by:jagguy
ID: 40508067
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
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
LVL 4

Expert Comment

by:hulsebosch
ID: 40508115
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
 
LVL 43

Expert Comment

by:Rob
ID: 40508145
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
 

Author Comment

by:jagguy
ID: 40520341
I dont need to email just yet  it seems so I dont need the question
0

Featured Post

Building an interactive eFuture classroom

Watch and learn how ATEN provided a total control system solution including seamless switching matrix switch, HDBaseT extenders, PDU, lighting control to build an interactive eFuture classroom.

Question has a verified solution.

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

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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.
Suggested Courses

719 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