spatie / mailcoach-support

Questions and support for Mailcoach
https://mailcoach.app
31 stars 2 forks source link

Custom replacers not working with custom mailable #192

Closed funkdoobiest closed 4 years ago

funkdoobiest commented 4 years ago

Hi,

when I add a campaign with a custom mailable, my custom replacers are not working. I do not know why, but this workaround helps me:

$campaign = Campaign::create()
            ->useMailable(MonthlyStatsMail::class)
            ->segment(ShouldSendMonthlyStats::class);

        $campaign->name = "Test";
        $campaign->subject = 'Test';
        $campaign->email_list_id = 2;
        $campaign->content($campaign->contentFromMailable());
        $campaign->mailable_class = null;
        $campaign->save();

I set the mailable to "null" after setting content and then it's working like expected.

PHP 7.4.5 Mailcoach 2.11.5

riasvdv commented 4 years ago

I've just added a test with a custom Mailable & Replacer and everything works as expected.

Could you give a little more context:

ziming commented 4 years ago

@riasvdv Isn't there a still open PR on this? Waiting for it to get merged too :)

https://github.com/spatie/laravel-mailcoach/pull/225

riasvdv commented 4 years ago

Seems like that PR will indeed solve your issue, I'm closing this in favor for the PR. If the author can't work on it anymore we'll pick it up!

jbraband commented 4 years ago

The PR is ready for @riasvdv to review