jdavidbakr / mail-tracker

Package for Laravel to inject tracking code into outgoing emails.
MIT License
567 stars 129 forks source link

Mail body is duplicated when using a attachment. #197

Closed svenvanhees closed 1 year ago

svenvanhees commented 1 year ago

Started a new Laravel 9 project. Setup Mailtrap.io mailer. Installed the mail tracker package. Created a test mail. Send the test mail with tinker. Email received, but the html content is duplicated.

image

\App\Mail\Test.php

<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;

class Test extends Mailable
{
    use Queueable, SerializesModels;

    /**
     * Create a new message instance.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        return $this
            ->markdown('mail::message')
            ->with([ 'slot' => 'Testing' ])
            ->attachData('Testing', "testing.txt");
    }
}

Mail::to('testing@test.com')->send(new \App\Mail\Test());

svenvanhees commented 1 year ago

I think #182 / #183 is causing this problem. Commenting that piece of code, results in a normal email with attachment.

svenvanhees commented 1 year ago

Suggest to approve #198 @jdavidbakr to resolve this issue.

jdavidbakr commented 1 year ago

PR merged and released