{"id":7878,"date":"2025-10-01T14:41:13","date_gmt":"2025-10-01T14:41:13","guid":{"rendered":"https:\/\/ioninteractive.com\/ionacademy\/?p=7878"},"modified":"2025-10-01T14:41:14","modified_gmt":"2025-10-01T14:41:14","slug":"scriptlet-server-scriptlet-to-reject-personal-emails-in-form-submission","status":"publish","type":"post","link":"https:\/\/ioninteractive.com\/ionacademy\/scriptlet-server-scriptlet-to-reject-personal-emails-in-form-submission\/","title":{"rendered":"Scriptlet: Server scriptlet to reject personal emails in form submission"},"content":{"rendered":"\n<p class=\"\">For Ion forms it is possible to reject select email addresses or email domains by implementing a few simple advanced rules at both the form and page levels. If you would like to reject a specific set of email addresses, continue following the suggestions in this help article:<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-ion-academy-by-ion-interactive wp-block-embed-ion-academy-by-ion-interactive\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"wdJ0IAnHEM\"><a href=\"https:\/\/ioninteractive.com\/ionacademy\/how-to-reject-personal-emails\/\">How To Reject Personal Emails<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; visibility: hidden;\" title=\"&#8220;How To Reject Personal Emails&#8221; &#8212; Ion Academy by Ion Interactive\" src=\"https:\/\/ioninteractive.com\/ionacademy\/how-to-reject-personal-emails\/embed\/#?secret=SxeRkDpGID#?secret=wdJ0IAnHEM\" data-secret=\"wdJ0IAnHEM\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p class=\"\">If you would like to reject common personal email addresses generally, you can implement the following scriptlet for a quicker turnaround. The scriptlet \u201cPersonal Email Reject Condition\u201d evaluates if the EmailAddress data field contains any of the following terms:&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"\">aol<\/li>\n\n\n\n<li class=\"\">gmail<\/li>\n\n\n\n<li class=\"\">gmx<\/li>\n\n\n\n<li class=\"\">hotmail<\/li>\n\n\n\n<li class=\"\">hushmail<\/li>\n\n\n\n<li class=\"\">icloud.com<\/li>\n\n\n\n<li class=\"\">mail.com<\/li>\n\n\n\n<li class=\"\">outlook<\/li>\n\n\n\n<li class=\"\">proton and protonmail<\/li>\n\n\n\n<li class=\"\">yahoo<\/li>\n\n\n\n<li class=\"\">zoho<\/li>\n<\/ul>\n\n\n\n<p class=\"\">It returns true if any one of those terms were found in the EmailAddress datafield, and false otherwise.<\/p>\n\n\n\n<p class=\"\"><strong>Step 1 &#8211; Install the scriptlet in your Ion console.&nbsp;<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li class=\"\">Navigate to Libraries > Server Scriptlets<\/li>\n\n\n\n<li class=\"\">Click green \u201cNew scriptlet category\u201d and give it a label<\/li>\n\n\n\n<li class=\"\">Click green \u201cNew scriptlet\u201d button and label the scriptlet<\/li>\n\n\n\n<li class=\"\">Paste or write custom Javascript into the scriptlet field<\/li>\n\n\n\n<li class=\"\">Save<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>var personalEmailDomains = &#91;\"gmail\", \"hotmail\", \"aol\", \"yahoo\", \"gmx\", \"hushmail\", \"icloud.com\", \"outlook\", \"mail.com\", \"zoho\", \"proton\", \"protonmail\"]\n\nif(respondent&#91;\"customEmailDomains\"] != null) personalEmailDomains =  respondent&#91;\"customEmailDomains\"].split(\",\")\n\nvar emailRegex = new RegExp(personalEmailDomains.join(\"|\"));\nvar targetField = respondent&#91;\"targetField\"] || \"emailaddress\"\nvar email = respondent&#91;targetField]\n\nif(email == null || email == \"\") return true;\n\nreturn emailRegex.test(email)<\/code><\/pre>\n\n\n\n<p class=\"\"><br><br><strong>Additional Information:<\/strong> Note, use server-side Javascript (ECMAScript Version 3) to process data. The script should return a string or null.<\/p>\n\n\n\n<p class=\"\"><strong>Step 2 &#8211; Use rules to run your scriptlet on your Ion form<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li class=\"\">Navigate to the Ion page where you have your form set up;<\/li>\n\n\n\n<li class=\"\">If you would like the scriptlet to run on form submission, click the form\u2019s submit button in Content Studio and then open the rules editor from within the Edit tab.<\/li>\n\n\n\n<li class=\"\">Add a rule condition to trigger the scriptlet \u201cServer scriptlet result\u201d and select the scriptlet from the dropdown to the right.<\/li>\n\n\n\n<li class=\"\">Add the action labeled \u201cSave data\u201d with the value \u201cresultText\u201d and the error message you\u2019d like to be displayed to the visitor if they provide an email address that\u2019s not acceptable.<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"534\" loading=\"lazy\" src=\"https:\/\/ioninteractive.com\/ionacademy\/wp-content\/uploads\/2025\/10\/image-1024x534.png\" alt=\"\" class=\"wp-image-7880\" srcset=\"https:\/\/ioninteractive.com\/ionacademy\/wp-content\/uploads\/2025\/10\/image-1024x534.png 1024w, https:\/\/ioninteractive.com\/ionacademy\/wp-content\/uploads\/2025\/10\/image-300x156.png 300w, https:\/\/ioninteractive.com\/ionacademy\/wp-content\/uploads\/2025\/10\/image-768x400.png 768w, https:\/\/ioninteractive.com\/ionacademy\/wp-content\/uploads\/2025\/10\/image.png 1305w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"\"><strong>Step 3 &#8211; Optional: Add a text box to display the error message<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li class=\"\">Add a text element to your form page at a location of your choice.\u00a0<\/li>\n\n\n\n<li class=\"\">Add \u201cresultText\u201d in double curly brackets in the text element and style as required.\u00a0<\/li>\n\n\n\n<li class=\"\">Hit \u201cApply\u201d to save.<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>For Ion forms it is possible to reject select email addresses or email domains by implementing a few simple advanced rules at both the form and page levels. If you would like to reject [&hellip;]<\/p>\n","protected":false},"author":24,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","footnotes":""},"categories":[2082],"tags":[2173,2332,2190],"class_list":["post-7878","post","type-post","status-publish","format-standard","hentry","category-scriptlets","tag-advanced","tag-scriplets","tag-scriptlets"],"_links":{"self":[{"href":"https:\/\/ioninteractive.com\/ionacademy\/wp-json\/wp\/v2\/posts\/7878","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ioninteractive.com\/ionacademy\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ioninteractive.com\/ionacademy\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ioninteractive.com\/ionacademy\/wp-json\/wp\/v2\/users\/24"}],"replies":[{"embeddable":true,"href":"https:\/\/ioninteractive.com\/ionacademy\/wp-json\/wp\/v2\/comments?post=7878"}],"version-history":[{"count":1,"href":"https:\/\/ioninteractive.com\/ionacademy\/wp-json\/wp\/v2\/posts\/7878\/revisions"}],"predecessor-version":[{"id":7881,"href":"https:\/\/ioninteractive.com\/ionacademy\/wp-json\/wp\/v2\/posts\/7878\/revisions\/7881"}],"wp:attachment":[{"href":"https:\/\/ioninteractive.com\/ionacademy\/wp-json\/wp\/v2\/media?parent=7878"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ioninteractive.com\/ionacademy\/wp-json\/wp\/v2\/categories?post=7878"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ioninteractive.com\/ionacademy\/wp-json\/wp\/v2\/tags?post=7878"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}