drv16821 2017-05-12 14:29
浏览 54
已采纳

在Laravel 5.3中添加用于密码重置的Mailgun标记

I'm using Laravel's built in login system (php artisan make:auth) and I linked my Mailgun account for sending reset emails. But how can I define tags?

According to Mailgun's documentation tag needs to be added to function that sends emails.

https://documentation.mailgun.com/user_manual.html#tagging

'o:tag'   => 'Password reset'

Where can I find that function and how to add o:tag into it?

  • 写回答

1条回答 默认 最新

  • douzhao4071 2018-02-07 16:54
    关注

    You can do it with headers. I am using Laravel 5.5 with Mailable

    public function build()
    {
        $emailData = [
            'subject'       => $this->data['subject'],
            'groupName'     => $this->data['groupName'],
            'acceptUrl'     => $this->data['acceptUrl'],
            'declineUrl'    => $this->data['declineUrl'],
            'email'         => $this->data['email'],
        ];
    
        return $this
            ->subject($this->data['subject'])
            ->markdown('emails.group.invitation')
            ->with($emailData)
            ->withSwiftMessage(function($message) {
                $headers = $message->getHeaders();
                $headers->addTextHeader("X-Mailgun-Variables", '{"type": "group-invitation"}');
                $headers->addTextHeader("X-Mailgun-Tag", "group-invitation");
            });
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 adb连接不到手机是怎么回事?
  • ¥15 vs2022无法联网
  • ¥15 TCP的客户端和服务器的互联
  • ¥15 VB.NET操作免驱摄像头
  • ¥15 笔记本上移动热点开关状态查询
  • ¥85 类鸟群Boids——仿真鸟群避障的相关问题
  • ¥15 CFEDEM自带算例错误,如何解决?
  • ¥15 有没有会使用flac3d软件的家人
  • ¥20 360摄像头无法解绑使用,请教解绑当前账号绑定问题,
  • ¥15 docker实践项目