Mail is not sending in cakephp 3.0

时间:2016-10-20 13:12:21

标签: email cakephp cakephp-3.0

I Have faced lots of error and now soo close that hole send function is executing then then redirect to anather page but the problem is mail is not sending. Any Idea, Thank you in advance

<?php
    namespace App\Controller;
    use Cake\ORM\TableRegistry;

    use App\Controller\AppController;
    use Cake\Mailer\Email;
    function send(){
    $name=$this->request->data('name');
            $receiver_email='adangwa111@gmail.com';
            $Subject_Title=$this->request->data('sub');
            $Sender_email=$this->request->data('yemail');

    $email = new Email();
    $email->template('invite', 'default')
        ->emailFormat('html')
        ->from('Amit@gmail.com')
        ->to('adangwa111@gmail.com')
        ->subject('About')

        ->send();
    $this->redirect(['controller'=>'Recommand','action' => 'index']);
    }
    }

And this is my App configuration

  'EmailTransport' => [
        'default' => [
            'className' => 'Smtp',
            // The following keys are used in SMTP transports
            'transport' => 'Smtp',
            'host' => 'ssl://smtp.gmail.com',
            'port' => 465,
            'timeout' => 35,
            'username' => '*******@gmail.com',
            'password' => '********',
            'client' => null,

        ],
    ],

2 个答案:

答案 0 :(得分:0)

Its just front end problem. I have been trying action for long then atlast I connect it with front end. It work fine

答案 1 :(得分:0)

我在我的App文件中有这个配置

panic!

请检查您的服务器上是否也能正常使用。在开始这项工作之前,我还尝试了很多组合。