0

如何使用 Laravel 5.5 同时发送电子邮件和短信?

我应该使用可邮寄和 SMS 服务还是使用 SMS 通知以及如何使用?

4

2 回答 2

0

你可以在 laravel 的 App/Events 文件夹中创建一个事件。将所有用于发送邮件和短信的代码都放在那里配置,只需在您想点击短信或邮件的任何地方调用该事件即可。

于 2018-08-30T13:00:23.590 回答
0

您可以创建一个函数,其中包括用于电子邮件的 notify() 方法和用于消息
示例的 dispatch() 方法

   public function Notification(Model $tender)
{
    $user = access()->user();
    /* Send confirmation email */
        $tender->notify(new Email($user));

    /* Send confirmation message */

    Send::dispatch($user);
}

然后,您只需调用一个函数 Notification() 即可发送电子邮件和消息

于 2019-01-09T11:05:21.957 回答