Mautic Community Forums

How to use a form to send emails to a segment

I would like to create a form (maybe put it on an landing page) with one input field for text.
On form submission Mautic should send a template email to a segment and replace a token in the email template with the text entered in the form. This should be repeatable with different text at any time.

Actually i made it half way as i created an email template (not segment email) and use this on form submission action. But there i cannot choose a segment as target, but only internal users of Mautic.

Any idea how to accomplish this?

Hi,
You can save the text in a newly created field.
Create an email template with this field in it:
{contactfield=yournewfieldalias}
Add campaign action ‘modify contact’s segment’
Launch a campaign for this segment, where you send out the previously created template email as action.
Should be working.
Good luck.

Thanks for helping. This rely on information stored in each contact. What i am looking for is to use “arbitrary data” from an form or via API to be replaced in the mail sent.

What i was looking for is more like sending an email to an contact (which is also available via API) where i can add “tokens” to be replaced before sending. But i struggle to build a tool fetching all contacts of a segment and send an invidual mail to each of them…

I’m not sure I understand.
You can also push in data via API, store it in the contact and add use this custom content to display in email.

Like:

Customfield alias: ‘moviepreference’
Push in via API: moviepreference = ‘Back To The Future’

Hey Joey
Your favorite movie, {contactfield=moviepreference} is on!
Regards:
Netflix

J

I see your point, but where not talking about the same :slight_smile:

To make i clear: I do not want to use some contact data in the email. I’d like to use data which is given at runtime. The data i want to be replaced in the mail template cannot be stored in the contact. It also has no relation to the contact.

Maybe it’s more clear with a example use-case:
Send an email to the contacts of a segment called “vip customers” every day, putting a special offer in it. The special offer is just made of text like “Today best price for tomatos is $1.99 per slice” (or whatever). A guy from marketing should have a simple input field (form?) to put that data, press “publish” and the mail is sent by Mautic.
Also Mautic should handle all the replies (links klicked) in the template, like “Yes, i’d like to buy” oder “No, not interested in this”.

Okay, So why the Marketing guy doing this:

  1. Clone email
  2. Change the ONE LINE OF TEXT to "1 / slice" from yesterday's "0.9 / slice".
  3. Send to the same segments (vip) as the day before

The other option would be:
Create the whole email by API and push it in.

I also thought this way, but it is wise to create hundreds of emails inside Mautic? As a programmer i would void that solution because this is what tokens/variables are good for…

Email copies take almost no space in the DB.
Not like page tracking…
I don’t know any newsletter system that does it differently.

I tried this and it works of course. When i use this i need to somehow enumerate the email names/aliases.

But after all, why can tokens be used to send separate emails and template emails but not in segment emails?