Mautic Community Forums

How to create a Campaign to send one out of 30 emails randomly

I have created around 30 emails, each one of them has one or two “Tips” on how to use my certain products. Now, I want to build a Campaign to send one of the 30 emails randomly to all contacts in a segment on every few days.

Any idea how can I get it done?

Do you want the contacts to receive all emails eventually or only a portion of them?

If you can develop a plugin then I think there might be a way. you can subscribe to campaign trigger event and change the email you wish to send.

If you want to send unique email every time then you’ll have to keep a count(may be store email ids in a custom field and match to ensure last sent mail wasn’t this), else if you want to choose randomly that would be fairly easy with event subscriber approach.

all emails should go eventually and later cycle should start again… “cycle” means not in the exact same sequence of emails sent in the first cycle but all 30 emails should go again in random order.

can you please provide anymore hint on this?

What i mean is you will need to develop a plugin which randomly take a user from either whole system of a segment and trigger email.

for more information on developing plugin you can refer to https://developer.mautic.org/#plugins

what I think should be a good idea is:
create a custom campaign action(https://developer.mautic.org/#extending-campaigns) let’s say “Send Random Email”.
Then set up a campaign with segment and this action.

finally your action should be to choose random email from your email list and send email(via this action). https://developer.mautic.org/#models(see this example for sending emails from code).

2 Likes

Great job buddy… let me look into it…

Thanks a ton!