Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using an invalid email address in forms, will result in Swift_RfcComplianceException #27

Closed
acki-m opened this issue Dec 3, 2015 · 1 comment

Comments

@acki-m
Copy link

acki-m commented Dec 3, 2015

When I input an invalid email address (e.g. 'm') in an email field and send it, I get a php exception:

Swift_RfcComplianceException
Address in mailbox given [m] does not comply with RFC 2822, 3.6.2. 

Someone in the forum mentioned, that it is possible to enable HTML5 client side check:
http://getgrav.org/forum#!/?Swift_RfcComplianceException
However, this option does nothing, because I have it enabled, please check if this is true?

What I want

The email check should be done serverside. The contact form should pop up again, where the email field is marked red, and the user see that the email is invalid. Also maybe gets a text message.

PS: In the docs I found nothing mentioned about validation rules
PPS: IMPORTANT, I found out that the docs has an error in the sample code which I copy-pasted:
http://learn.getgrav.org/advanced/forms

type: text

for the field email is wrong. So the client side HTML rule is not applied.

@flaviocopes
Copy link
Contributor

I suggested that in the forum, actually I'm not sure where I got that.

If you use the email field type instead of text, the email address is already validated in browsers that support the email field (http://caniuse.com/#feat=input-email-tel-url). Plus, it's validated server-side.

You're right, I fixed the Learn site docs, you can fix them too next time, just click "Edit this page" on the top right of it and post a PR ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants