putyourlightson / craft-campaign

Send and manage email campaigns, contacts and mailing lists in Craft CMS.
https://putyourlightson.com/plugins/campaign
Other
63 stars 25 forks source link

Stop individual emails sending if email body is blank #372

Closed green17 closed 1 year ago

green17 commented 1 year ago

We have a newletter setup to go out weekly. This newsletter will provide a listing of the 10 latest entries related to the combination of options selected by the user upon signing up for the newsletter. We are able to do this but, since the list of entries is unique to each user, it is likely that sometimes the list will be empty. In this case, we would like that particular email to not send, but for the rest to send. Is there a way of achieving this behavoiur?

Campaign Pro 1.24.1 Craft Pro 3.7.43

bencroker commented 1 year ago

This is achievable in Campaign 2 using sendout condition rules, which are extremely flexible. There’s even an example that you can use as a starting point at https://github.com/putyourlightson/craft-campaign/blob/v2/examples/conditions/sendouts/RecentEntriesPublishedConditionRule.php

If you’re stuck on Campaign 1 (Craft 3) then you could use a Template Segment to perform this check, but Template Segments are not particularly performant so it would be unadvisable to use on large mailing lists (in the thousands).

green17 commented 1 year ago

Thanks Ben, we will be using Campaign 1 but I don't think the mailing list size will be in the thousands.

bencroker commented 1 year ago

In that case a Template Segment should work just fine.