Closed Propaganistas closed 4 years ago
Looking in the database, it seems the mailcoach_campaigns.subject
column gets emptied, when sending a campaign...
EDIT: I just created a new campaign and launched sending while refreshing the database. The subject is indeed being emptied while the campaign is in "sending" status!
Verifying...
I'm trying to recreate the project using a test. Seems like this one is passing: https://github.com/spatie/laravel-mailcoach/blob/faf788b7ab96724a29a0e8bcca94222312281de9/tests/Jobs/SendCampaignJobTest.php#L88-L101
@Propaganistas Can you provide a failing test for me to fix. Will test in a real world app now...
I'm using v2.11.4
of mailcoach on freek.dev. There, using a custom subject seems to be working fine.
O, noticed that you are using the test mail, not the actual campaign...
Seems test mail subject are working fine as well.
This test proves that the subject should be ok, even for a test mail: https://github.com/spatie/laravel-mailcoach/blob/305d23ae09a87786fd4f94b26d70c3f5b1db946f/tests/Jobs/SendTestMailJobTest.php#L31
I appreciate any tips on how to reproduce the problem you are seeing.
I'm on a completely fresh install of Mailcoach 2.11.3. No fancy settings... Let's set up a call? I'll email you.
Unfortunately, I don't have time for a call atm. Could you try upgrading to the latest version?
Okay got it. I did configure a custom replacer that merely substitutes a placeholder for the current year. Nothing too fancy, almost copy-paste from the docs.
But here's the catch. The docs are leading to this "bug":
public function replace(string $html, Campaign $campaign): string
{
$webviewUrl = $campaign->webviewUrl();
return str_ireplace('::webviewUrl::', $webviewUrl, $campaign->email_html);
}
should be
public function replace(string $html, Campaign $campaign): string
{
$webviewUrl = $campaign->webviewUrl();
return str_ireplace('::webviewUrl::', $webviewUrl, $html);
}
It seems that performing substitution and returning $campaign->email_html
again loses the subject somehow.
I guess this is sorted out. Sorry to make all the fuss, but I did everything by the book ;-) You might want to update your documentation.
Thanks for letting us know. The docs have been updated.
I'm on Mailcoach 2.11.3
I've configured a campaign with the following settings and I'm using Mailgun:
Luckily I sent the campaign with a test list first, because apparently the set subject isn't retained:
Seems to happen with both immediate and scheduled delivery. Test mails do use the set subject...