Conditional Logic in Email Action?

By: Michael Clark | Asked: 06/02/2022
ForumsCategory: How-toConditional Logic in Email Action?
Michael ClarkMichael Clark asked 3 years ago

Wondering if there's a workaround for getting conditionals to work in the Email form action?
In my form, I have the standard name, email address, and message body, and also checkboxes that correspond to conditions in the email action:

<p>[id_of_message]</p>
<p>[if checkbox_id="this value"]Include this line in the email message.[/if checkbox_id]</p>
<p>[if checkbox_id="that value"]Include that line in the email message.[/if checkbox_id]</p

 

I use SendGrid for my emails and Twilio for my SMSes, and I don't think SendGrid is stripping the conditional. If it is, it's not in the logs.
Any insights would be greatly appreciated.

 

 

 

Bobby Clapp replied 3 years ago

I don't think I will have an answer, but how are those applications connected to FP?

Michael ClarkMichael Clark replied 3 years ago

SendGrid replaces the default wpmail via smtp through their API since there's no native Formidable extension for mail, and I use the native Formidable extension to connect to Twilio.

Pretty sure conditionals in emails are just supposed to work, right? Unless someone can point me to a tech note on the Formidable site. I'm usually pretty good a finding stuff there, but it's kind of a cluster at times. 🙂

1 Answers
Victor Font answered 3 years ago
Using Sendgrid shouldn't interfere with Formidable's conditionals because Formidable processes the data before the email is sent. Especially if you're using a SMTP plugin to connect to Sendgrid, all the processing is still handled by Formidable. I would do 2 things to help diagnose this issue. To test, I would install an email logger so you can see the contents of the emails being sent to SentGrid. Then I would revert back to WPMail and see if that makes a difference because right now, there's no definitive way to determine where the emails are failing.
Michael ClarkMichael Clark replied 3 years ago

Thanks, Victor. Glad for these pointers. I have done, and the thing is the mail isn't failing, only the conditionals. I did have an issue on another project where links in emails were getting stripped or corrupted because I was using SendGrid's branded email thing to rewrite urls as coming from the same domain. But that's not it, either, since the conditionals are just single, additional lines added to the message if a checkbox value is present.

But you have givien me an idea: I have 5 conditional lines. Rather than use the conditionals *inside* the message, I'll test by taking them all out, and making a single email action, creating a condition on the entire action, rather than within the email message itself.

As always, appreciate your insights.

Michael ClarkMichael Clark replied 3 years ago

Well, there was a placeholder link in *one* of the five conditionals. That gets stripped out. It also gets stripped out, period.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right