【问题标题】:Laravel 5 password reset through sendinblue通过 sendinblue 重置 Laravel 5 密码
【发布时间】:2016-05-26 16:00:24
【问题描述】:

我有一个 laravel 5 应用程序,需要通过 sendinblue 服务发送重置密码链接。如何更改核心功能以在 PasswordBroker.php 中使用 sendinblue?

public function emailResetLink(
    CanResetPasswordContract $user,
    $token,
    Closure $callback = null
) {
    $mailin = new Mailin(
        'https://api.sendinblue.com/v2.0',
        '0TYSSJBSKERNDKW'
    );

    $view = $this->emailView;

    return $this->mailer->send(
        $view, 
        compact('token', 'user'),
        function($m) use ($user, $token, $callback) 
        {
            $m->to($user->getEmailForPasswordReset());

            if ( ! is_null($callback))
            {
                call_user_func($callback, $m, $user, $token);
            }
        });
}

【问题讨论】:

    标签: laravel sendinblue


    【解决方案1】:

    您是否尝试将 Sendinblue 添加为邮件驱动程序?这个 github 仓库可以提供帮助 (https://github.com/agence-webup/laravel-sendinblue)

    您所有的电子邮件都将由 Sendinblue 发送,您将在 Laravel (https://laravel.com/docs/5.1/mail) 中作为普通邮件发送

    如果只是为了这个,你可以只为这种邮件更改驱动程序,我认为你可以像这样在运行时更改驱动程序

    Config::set('mail.driver', 'driver_name');
    (new Illuminate\Mail\MailServiceProvider(app()))->register();  
    

    另外,您可以尝试监听在发送邮件消息之前触发的“mailer.sending”事件,但这不是一个好方法。

    【讨论】:

    • 这不起作用,因为我使用的是 Laravel 5.0,这是 5.1
    • 这给了我作曲家错误 - 您的要求无法解析为一组可安装的软件包
    • 也许更新到 Laravel 5.1 会更容易,我发给你的第一个驱动真的很好,看起来更容易工作。我不相信将 5.0 更新到 5.1 会很困难
    猜你喜欢
    • 2015-05-27
    • 2019-03-26
    • 2015-09-09
    • 2017-08-02
    • 2016-01-05
    • 2015-07-01
    • 2019-01-12
    • 2023-03-27
    • 2015-11-28
    相关资源
    最近更新 更多