lundi 27 novembre 2017

Why mail laravel not working on the staging server?

I try on the my localhost, it works

But if I try on the staging server, it does not works

My controller like this :

<?php
use Illuminate\Support\Facades\Mail;
use App\Mail\OrderReceivedMail;
...
class PurchaseController
{
    ...
    public function test() {
        $order = $this->order_repository->find(416);
        $user = $this->user_repository->find(1);
        Mail::to($user)->send(new OrderReceivedMail($order, $order->store));
    }
}

My mail like this :

<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
class OrderReceivedMail extends Mailable implements ShouldQueue
{
    use Queueable, SerializesModels;
    public $order;
    public $store;
    public function __construct($order, $store)
    {
        $this->order = $order;
        $this->store = $store;
        $this->subject('subject');
    }
    public function build()
    {
        $mail_company = explode(',',config('app.mail_company'));
        // dd($mail_company, $this->order->number, $this->store->name, 'test');
        return $this->view('vendor.notifications.mail.email-order',['number'=>$this->order->number, 'store_name' => $this->store->name])->bcc($mail_company);
    }
}

I try add this :

dd($mail_company, $this->order->number, $this->store->name, 'test');

on the mail

If in my localhost, the result of dd show

But if in the staging server, the result of dd not show

Seems if the staging server, it does not run this statement :

Mail::to($user)->send(new OrderReceivedMail($order, $order->store));

How can I solve this problem?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2Ad9XEC
via IFTTT

Aucun commentaire:

Enregistrer un commentaire