如何修复local.ERROR:使用Laravel加载cafile流失败

时间:2019-07-29 05:27:21

标签: php laravel

我在local.ERROR上遇到问题:无法加载cafile流:C:\ xampp \ apache \ bin \ curl-ca-bundle.crt',在此之前,我目前正在开发新系统Cron Job是每天电子邮件调度。现在,我只是创建电子邮件的基本概念。然后我用Laravel来创建这个系统。

我只是遵循此说明failed loading cafile stream: `C:\xampp\apache\bin\curl-ca-bundle.crt'

但是,在我的laravel日志上仍然显示

    [2019-07-29 05:21:55] local.ERROR: failed loading cafile stream: `C:\xampp\apache\bin\curl-ca-bundle.crt' {"exception":"[object] (ErrorException(code: 0): failed loading cafile stream: `C:\\xampp\\apache\\bin\\curl-ca-bundle.crt' at C:\\xampp\\htdocs\\CronSystem\\vendor\\swiftmailer\\swiftmailer\\lib\\classes\\Swift\\Transport\\StreamBuffer.php:94)
[stacktrace]

我将与大家分享我的密码。

在我的邮件文件夹上

    <?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;

class SendMailApplication extends Mailable
{
    use Queueable, SerializesModels;

    /**
     * Create a new message instance.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        return $this->view('Emailing')
        ->to('hiddeeeee@gmail.com','hideeee')
        ->from('noreplyhideee@gmail.com', 'New Applicant');
    }
}

我的命令:

    <?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use DB;
use App\User;
use App\Mail\SendMailApplication;

class Emailing extends Command
{   

    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'emailing:cron';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Ready to fire emailing each user...';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {   


        \Mail::send(new SendMailApplication());

        // $users = User::all();

        // foreach($users as $user) {

        //     // Create a unique 8 character promo code for user
        //     // $new_promo_code = new PromoCode([
        //     //     'promo_code' => str_random(8),
        //     // ]);

        //     // $user->promo_code()->save($new_promo_code);

        //     // Send the email to user
        //     Mail::send('emailing', ['user' => $user], function ($mail) use ($user) {
        //         $mail->to($user['email'])
        //             ->from('noreplyhfiofi@gmail.com', 'Company')
        //             ->subject('Happy Birthday!');
        //     });

        // }

        // $this->info('Birthday messages sent successfully!');
        // // \Log::info("Email sent!");
        // //script which you have run in cron
    }
}

我的内核:

    <?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
        //
        'App\Console\Commands\Emailing',
    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        //Schedule happen here... 

        $schedule->command('emailing:cron')
                 ->everyMinute();
    }

    /**
     * Register the commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        $this->load(__DIR__.'/Commands');

        require base_path('routes/console.php');
    }
}

.env

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=noreplyhfiofi@gmail.com   
MAIL_PASSWORD=hiflyer123
MAIL_ENCRYPTION=tls

0 个答案:

没有答案