[Solved] Email with single quote brake formalicious code

Hello, using formalicious I created an email field that is the field where the email is going to be send.
the problem is that it’s not working if the email contains a single quote: o’neil@mail.com

Error log:

An error occurred while trying to send the auto-responder email: You must provide at least one recipient email address.

What is the best way to proceed excluding telling the client that emails with single quotes are stupid! :sweat_smile:


This seems to be a general problem with FormIt (and not specific to Formalicious).

As far as I can tell, the value o'neil@mail.com gets converted to o'neil@mail.com which is then no longer a valid email address.

So in your call to FormIt you have to add the validator allowSpecialChars for your email field to make it work.


Or alternatively add a custom hook that reverts this specific conversion:

$email = $hook->getValue('email');
$email = str_replace("&#039;","'",$email);
$hook->setValue('email', $email);
return true;

As the client will inevitably run into further problems using an email address with a single quote in it could they be persuaded to set up an email alias of oneil@mail.com so that people who have problems emailing them can use this alternative address. This way they get to keep their stupid address, but you don’t have to use it.

Doesn’t the email validator catch this? Better to just tell them their email address is invalid rather than trying to somehow alter it to be valid imo:


o'neil@mail.com is not an invalid email address! The validator allowSpecialChars doesn’t alter the value but rather prevents it from being altered to o&#039;neil@mail.com.

1 Like

Thank you all for your help.
I was thinking that emails should not have especial characters but unfortunately single quote it’s allowed but thanks to the


It’s working.

So thank @halftrainedharry
What I’m doing now is using JS to make the validation, and ht e problem has been solved.

Thanks everybody!