vendredi 5 avril 2019

I am working with Laravel Notification I want to send Email if only Email address is avaiable

Currently, I am working with Laravel 5.7 Project

Now I am sending Laravel Notification (Email, SMS, and OneSignal Push)

User Email is optional(login with mobile). Now I want to send Email if and only if Email address is provided by user other wise I send SMS and Push notification will bew sent always(with both Email and SMS)

In the Notification i check

    public function toMail($notifiable)
    {
        if($emailAvailable = 1){
           return $(new MailMessage())->subject(__('Received Test Email  :app_name', ['app_name' => app_name()]))->view('mail.testView');
        }
        return false;
    }

Email is sending successfully if there is email address but if there is no email address return false is executed and queue fails and it retries to send again the queue never stop

How do I not Queue Email if email address is not available



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire