{"id":2218,"date":"2018-11-29T00:00:00","date_gmt":"2018-11-29T00:00:00","guid":{"rendered":"https:\/\/www.mailboxvalidator.com\/resources3\/articles\/how-to-use-mailboxvalidator-codeigniter-library-to-validate-email\/"},"modified":"2026-07-29T08:30:43","modified_gmt":"2026-07-29T08:30:43","password":"","slug":"how-to-use-mailboxvalidator-codeigniter-library-to-validate-email","status":"publish","type":"docs","link":"https:\/\/www.mailboxvalidator.com\/resources\/articles\/how-to-use-mailboxvalidator-codeigniter-library-to-validate-email\/","title":{"rendered":"How to use MailboxValidator CodeIgniter library to validate email?"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\"><figure><a href=\"https:\/\/www.mailboxvalidator.com\/resources\/wp-content\/uploads\/2020\/01\/mbv_articles_img5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-post-mid wp-image-1072\" src=\"https:\/\/www.mailboxvalidator.com\/resources\/wp-content\/uploads\/2020\/01\/mbv_articles_img5-600x300.png\" alt=\"How-to-use-MailboxValidator-CodeIgniter-library-to-validate-email\" width=\"600\" height=\"300\" srcset=\"https:\/\/www.mailboxvalidator.com\/resources\/wp-content\/uploads\/2020\/01\/mbv_articles_img5-600x300.png 600w, https:\/\/www.mailboxvalidator.com\/resources\/wp-content\/uploads\/2020\/01\/mbv_articles_img5-300x150.png 300w, https:\/\/www.mailboxvalidator.com\/resources\/wp-content\/uploads\/2020\/01\/mbv_articles_img5-1024x512.png 1024w, https:\/\/www.mailboxvalidator.com\/resources\/wp-content\/uploads\/2020\/01\/mbv_articles_img5-768x384.png 768w, https:\/\/www.mailboxvalidator.com\/resources\/wp-content\/uploads\/2020\/01\/mbv_articles_img5-50x25.png 50w, https:\/\/www.mailboxvalidator.com\/resources\/wp-content\/uploads\/2020\/01\/mbv_articles_img5-920x460.png 920w, https:\/\/www.mailboxvalidator.com\/resources\/wp-content\/uploads\/2020\/01\/mbv_articles_img5-320x160.png 320w, https:\/\/www.mailboxvalidator.com\/resources\/wp-content\/uploads\/2020\/01\/mbv_articles_img5.png 1200w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/figure><\/h2>\n\n\n\n<h2 class=\"wp-block-heading\">Overview<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In this tutorial, we will demonstrate how to use the MailboxValidator CodeIgniter library to validate email addresses. The MailboxValidator CodeIgniter library provides an easy way to integrate the MailboxValidator API into your CodeIgniter application for email validation.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Since this library uses the MailboxValidator API, you must obtain a free API key before using it. Simply visit <a href=\"https:\/\/www.mailboxvalidator.com\/plans#api\">https:\/\/www.mailboxvalidator.com\/plans#api<\/a> to sign up for the FREE API plan, and you will receive a free API key.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After obtaining your API key, open <code>application\/config\/config.php<\/code> and add the following line:<\/p>\n\n\n\n<div class=\"betterdocs-code-snippet-wrapper theme-light betterdocs-code-snippet-a7f4400c\"\n     id=\"betterdocs-code-snippet-a7f4400c\"\n     data-language=\"javascript\"\n     data-copy-button=\"true\">\n\n            <div class=\"betterdocs-code-snippet-header betterdocs-file-preview-header\">\n        <div class=\"betterdocs-file-preview-left\">\n                            <div class=\"betterdocs-traffic-lights\">\n                    <span class=\"traffic-light traffic-light-red\"><\/span>\n                    <span class=\"traffic-light traffic-light-yellow\"><\/span>\n                    <span class=\"traffic-light traffic-light-green\"><\/span>\n                <\/div>\n            \n            <div class=\"betterdocs-file-info\">\n                \n                            <\/div>\n        <\/div>\n\n        <div class=\"betterdocs-file-preview-right\">\n                            <div class=\"betterdocs-code-snippet-copy-container\">\n                    <button class=\"betterdocs-code-snippet-copy-button\"\n                            type=\"button\"\n                            data-clipboard-target=\"#betterdocs-code-snippet-a7f4400c .betterdocs-code-snippet-code code\"\n                            aria-label=\"Copy code to clipboard\">\n                        <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <path d=\"M16 1H4C2.9 1 2 1.9 2 3V17H4V3H16V1ZM19 5H8C6.9 5 6 5.9 6 7V21C6 22.1 6.9 23 8 23H19C20.1 23 21 22.1 21 21V7C21 5.9 20.1 5 19 5ZM19 21H8V7H19V21Z\" fill=\"currentColor\"\/>\n                        <\/svg>\n                    <\/button>\n                                    <\/div>\n                    <\/div>\n        <\/div>\n    \n    <div class=\"betterdocs-code-snippet-content\">\n        \n        <pre class=\"betterdocs-code-snippet-code language-javascript\"><code>$config[&#039;mbv_api_key&#039;] = &#039;PASTE_YOUR_API_KEY_HERE&#039;;<\/code><\/pre>\n    <\/div>\n<\/div>\n\n<script type=\"text\/javascript\">\ndocument.addEventListener('DOMContentLoaded', function() {\n    \/\/ Initialize copy functionality for this specific snippet\n    const snippet = document.getElementById('betterdocs-code-snippet-a7f4400c');\n    if (snippet && window.BetterDocsCodeSnippet) {\n        window.BetterDocsCodeSnippet.initCopyButton(snippet);\n    }\n});\n<\/script>\n\n\n\n<h2 class=\"wp-block-heading\">Installation<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The installation of this library is very easy, just grab the library repository from <a href=\"https:\/\/github.com\/MailboxValidator\/mailboxvalidator-codeigniter\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/MailboxValidator\/mailboxvalidator-codeigniter<\/a>. Then upload the libraries folder to your CodeIgniter application folder.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This library will only work with CodeIgniter 3. For CodeIgniter 4, you can get it from <a href=\"https:\/\/github.com\/MailboxValidator\/mailboxvalidator-codeigniter4\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/MailboxValidator\/mailboxvalidator-codeigniter4<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Usage<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This library is for validating the email address. For example, validate an email address called &#8220;testing@example.com&#8221; and get the validation result for that email address. To do so, first load the library in your controller and initiate it:<\/p>\n\n\n\n<div class=\"betterdocs-code-snippet-wrapper theme-light betterdocs-code-snippet-de6900a7\"\n     id=\"betterdocs-code-snippet-de6900a7\"\n     data-language=\"javascript\"\n     data-copy-button=\"true\">\n\n            <div class=\"betterdocs-code-snippet-header betterdocs-file-preview-header\">\n        <div class=\"betterdocs-file-preview-left\">\n                            <div class=\"betterdocs-traffic-lights\">\n                    <span class=\"traffic-light traffic-light-red\"><\/span>\n                    <span class=\"traffic-light traffic-light-yellow\"><\/span>\n                    <span class=\"traffic-light traffic-light-green\"><\/span>\n                <\/div>\n            \n            <div class=\"betterdocs-file-info\">\n                \n                            <\/div>\n        <\/div>\n\n        <div class=\"betterdocs-file-preview-right\">\n                            <div class=\"betterdocs-code-snippet-copy-container\">\n                    <button class=\"betterdocs-code-snippet-copy-button\"\n                            type=\"button\"\n                            data-clipboard-target=\"#betterdocs-code-snippet-de6900a7 .betterdocs-code-snippet-code code\"\n                            aria-label=\"Copy code to clipboard\">\n                        <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <path d=\"M16 1H4C2.9 1 2 1.9 2 3V17H4V3H16V1ZM19 5H8C6.9 5 6 5.9 6 7V21C6 22.1 6.9 23 8 23H19C20.1 23 21 22.1 21 21V7C21 5.9 20.1 5 19 5ZM19 21H8V7H19V21Z\" fill=\"currentColor\"\/>\n                        <\/svg>\n                    <\/button>\n                                    <\/div>\n                    <\/div>\n        <\/div>\n    \n    <div class=\"betterdocs-code-snippet-content\">\n        \n        <pre class=\"betterdocs-code-snippet-code language-javascript\"><code>$this-&gt;load-&gt;library(&#039;mailboxvalidator&#039;);<\/code><\/pre>\n    <\/div>\n<\/div>\n\n<script type=\"text\/javascript\">\ndocument.addEventListener('DOMContentLoaded', function() {\n    \/\/ Initialize copy functionality for this specific snippet\n    const snippet = document.getElementById('betterdocs-code-snippet-de6900a7');\n    if (snippet && window.BetterDocsCodeSnippet) {\n        window.BetterDocsCodeSnippet.initCopyButton(snippet);\n    }\n});\n<\/script>\n\n\n\n<p class=\"wp-block-paragraph\">After that, you can retrieve the validation result for the email address like this:<\/p>\n\n\n\n<div class=\"betterdocs-code-snippet-wrapper theme-light betterdocs-code-snippet-e0c841a0\"\n     id=\"betterdocs-code-snippet-e0c841a0\"\n     data-language=\"javascript\"\n     data-copy-button=\"true\">\n\n            <div class=\"betterdocs-code-snippet-header betterdocs-file-preview-header\">\n        <div class=\"betterdocs-file-preview-left\">\n                            <div class=\"betterdocs-traffic-lights\">\n                    <span class=\"traffic-light traffic-light-red\"><\/span>\n                    <span class=\"traffic-light traffic-light-yellow\"><\/span>\n                    <span class=\"traffic-light traffic-light-green\"><\/span>\n                <\/div>\n            \n            <div class=\"betterdocs-file-info\">\n                \n                            <\/div>\n        <\/div>\n\n        <div class=\"betterdocs-file-preview-right\">\n                            <div class=\"betterdocs-code-snippet-copy-container\">\n                    <button class=\"betterdocs-code-snippet-copy-button\"\n                            type=\"button\"\n                            data-clipboard-target=\"#betterdocs-code-snippet-e0c841a0 .betterdocs-code-snippet-code code\"\n                            aria-label=\"Copy code to clipboard\">\n                        <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <path d=\"M16 1H4C2.9 1 2 1.9 2 3V17H4V3H16V1ZM19 5H8C6.9 5 6 5.9 6 7V21C6 22.1 6.9 23 8 23H19C20.1 23 21 22.1 21 21V7C21 5.9 20.1 5 19 5ZM19 21H8V7H19V21Z\" fill=\"currentColor\"\/>\n                        <\/svg>\n                    <\/button>\n                                    <\/div>\n                    <\/div>\n        <\/div>\n    \n    <div class=\"betterdocs-code-snippet-content\">\n        \n        <pre class=\"betterdocs-code-snippet-code language-javascript\"><code>$result = $this-&gt;mailboxvalidator-&gt;get_single_result(&#039;test@example.com&#039;);<\/code><\/pre>\n    <\/div>\n<\/div>\n\n<script type=\"text\/javascript\">\ndocument.addEventListener('DOMContentLoaded', function() {\n    \/\/ Initialize copy functionality for this specific snippet\n    const snippet = document.getElementById('betterdocs-code-snippet-e0c841a0');\n    if (snippet && window.BetterDocsCodeSnippet) {\n        window.BetterDocsCodeSnippet.initCopyButton(snippet);\n    }\n});\n<\/script>\n\n\n\n<p class=\"wp-block-paragraph\">To pass the result to the view, just simply add the $result to your view loader like this:<\/p>\n\n\n\n<div class=\"betterdocs-code-snippet-wrapper theme-light betterdocs-code-snippet-aebc515a\"\n     id=\"betterdocs-code-snippet-aebc515a\"\n     data-language=\"javascript\"\n     data-copy-button=\"true\">\n\n            <div class=\"betterdocs-code-snippet-header betterdocs-file-preview-header\">\n        <div class=\"betterdocs-file-preview-left\">\n                            <div class=\"betterdocs-traffic-lights\">\n                    <span class=\"traffic-light traffic-light-red\"><\/span>\n                    <span class=\"traffic-light traffic-light-yellow\"><\/span>\n                    <span class=\"traffic-light traffic-light-green\"><\/span>\n                <\/div>\n            \n            <div class=\"betterdocs-file-info\">\n                \n                            <\/div>\n        <\/div>\n\n        <div class=\"betterdocs-file-preview-right\">\n                            <div class=\"betterdocs-code-snippet-copy-container\">\n                    <button class=\"betterdocs-code-snippet-copy-button\"\n                            type=\"button\"\n                            data-clipboard-target=\"#betterdocs-code-snippet-aebc515a .betterdocs-code-snippet-code code\"\n                            aria-label=\"Copy code to clipboard\">\n                        <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <path d=\"M16 1H4C2.9 1 2 1.9 2 3V17H4V3H16V1ZM19 5H8C6.9 5 6 5.9 6 7V21C6 22.1 6.9 23 8 23H19C20.1 23 21 22.1 21 21V7C21 5.9 20.1 5 19 5ZM19 21H8V7H19V21Z\" fill=\"currentColor\"\/>\n                        <\/svg>\n                    <\/button>\n                                    <\/div>\n                    <\/div>\n        <\/div>\n    \n    <div class=\"betterdocs-code-snippet-content\">\n        \n        <pre class=\"betterdocs-code-snippet-code language-javascript\"><code>$this-&gt;load-&gt;view(&#039;YOUR_VIEW_NAME&#039;,$result);<\/code><\/pre>\n    <\/div>\n<\/div>\n\n<script type=\"text\/javascript\">\ndocument.addEventListener('DOMContentLoaded', function() {\n    \/\/ Initialize copy functionality for this specific snippet\n    const snippet = document.getElementById('betterdocs-code-snippet-aebc515a');\n    if (snippet && window.BetterDocsCodeSnippet) {\n        window.BetterDocsCodeSnippet.initCopyButton(snippet);\n    }\n});\n<\/script>\n\n\n\n<p class=\"wp-block-paragraph\">And then in your view file, call the validation results. For example:<\/p>\n\n\n\n<div class=\"betterdocs-code-snippet-wrapper theme-light betterdocs-code-snippet-7f74ec2a\"\n     id=\"betterdocs-code-snippet-7f74ec2a\"\n     data-language=\"javascript\"\n     data-copy-button=\"true\">\n\n            <div class=\"betterdocs-code-snippet-header betterdocs-file-preview-header\">\n        <div class=\"betterdocs-file-preview-left\">\n                            <div class=\"betterdocs-traffic-lights\">\n                    <span class=\"traffic-light traffic-light-red\"><\/span>\n                    <span class=\"traffic-light traffic-light-yellow\"><\/span>\n                    <span class=\"traffic-light traffic-light-green\"><\/span>\n                <\/div>\n            \n            <div class=\"betterdocs-file-info\">\n                \n                            <\/div>\n        <\/div>\n\n        <div class=\"betterdocs-file-preview-right\">\n                            <div class=\"betterdocs-code-snippet-copy-container\">\n                    <button class=\"betterdocs-code-snippet-copy-button\"\n                            type=\"button\"\n                            data-clipboard-target=\"#betterdocs-code-snippet-7f74ec2a .betterdocs-code-snippet-code code\"\n                            aria-label=\"Copy code to clipboard\">\n                        <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <path d=\"M16 1H4C2.9 1 2 1.9 2 3V17H4V3H16V1ZM19 5H8C6.9 5 6 5.9 6 7V21C6 22.1 6.9 23 8 23H19C20.1 23 21 22.1 21 21V7C21 5.9 20.1 5 19 5ZM19 21H8V7H19V21Z\" fill=\"currentColor\"\/>\n                        <\/svg>\n                    <\/button>\n                                    <\/div>\n                    <\/div>\n        <\/div>\n    \n    <div class=\"betterdocs-code-snippet-content\">\n        \n        <pre class=\"betterdocs-code-snippet-code language-javascript\"><code>echo $email_address;<\/code><\/pre>\n    <\/div>\n<\/div>\n\n<script type=\"text\/javascript\">\ndocument.addEventListener('DOMContentLoaded', function() {\n    \/\/ Initialize copy functionality for this specific snippet\n    const snippet = document.getElementById('betterdocs-code-snippet-7f74ec2a');\n    if (snippet && window.BetterDocsCodeSnippet) {\n        window.BetterDocsCodeSnippet.initCopyButton(snippet);\n    }\n});\n<\/script>\n\n\n\n<p class=\"wp-block-paragraph\">You can refer the full list of response parameters available at here:\u00a0<a href=\"https:\/\/www.mailboxvalidator.com\/api-single-validation\">https:\/\/www.mailboxvalidator.com\/api-single-validation<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The library can also help with form validation. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First, create a new file called\u00a0MY_Form_validation.php under application\/libraries. Then, open the file and add the following codes:<\/p>\n\n\n\n<div class=\"betterdocs-code-snippet-wrapper theme-light betterdocs-code-snippet-b512eafc\"\n     id=\"betterdocs-code-snippet-b512eafc\"\n     data-language=\"php\"\n     data-copy-button=\"true\">\n\n            <div class=\"betterdocs-code-snippet-header betterdocs-file-preview-header\">\n        <div class=\"betterdocs-file-preview-left\">\n                            <div class=\"betterdocs-traffic-lights\">\n                    <span class=\"traffic-light traffic-light-red\"><\/span>\n                    <span class=\"traffic-light traffic-light-yellow\"><\/span>\n                    <span class=\"traffic-light traffic-light-green\"><\/span>\n                <\/div>\n            \n            <div class=\"betterdocs-file-info\">\n                                    <div class=\"betterdocs-file-icon\">\n                                                    <span class=\"betterdocs-file-icon-emoji\">\ud83d\udc18<\/span>\n                                            <\/div>\n                \n                            <\/div>\n        <\/div>\n\n        <div class=\"betterdocs-file-preview-right\">\n                            <div class=\"betterdocs-code-snippet-copy-container\">\n                    <button class=\"betterdocs-code-snippet-copy-button\"\n                            type=\"button\"\n                            data-clipboard-target=\"#betterdocs-code-snippet-b512eafc .betterdocs-code-snippet-code code\"\n                            aria-label=\"Copy code to clipboard\">\n                        <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <path d=\"M16 1H4C2.9 1 2 1.9 2 3V17H4V3H16V1ZM19 5H8C6.9 5 6 5.9 6 7V21C6 22.1 6.9 23 8 23H19C20.1 23 21 22.1 21 21V7C21 5.9 20.1 5 19 5ZM19 21H8V7H19V21Z\" fill=\"currentColor\"\/>\n                        <\/svg>\n                    <\/button>\n                                    <\/div>\n                    <\/div>\n        <\/div>\n    \n    <div class=\"betterdocs-code-snippet-content\">\n        \n        <pre class=\"betterdocs-code-snippet-code language-php\"><code>&lt;?php\nif (!defined(&#039;BASEPATH&#039;)) exit(&#039;No direct script access allowed&#039;);\n\nclass MY_Form_validation extends CI_Form_validation {\n\nprotected $ci;\npublic function __construct(){\n\n$this-&gt;ci = &amp;get_instance();\n$this-&gt;ci-&gt;load-&gt;library(&#039;mailboxvalidator&#039;);\n}\n\npublic function disposable($email) {\nif ($this-&gt;CI-&gt;mailboxvalidator1-&gt;is_email_disposable($email) == true) {\n\/\/ If is_email_disposable return true, means the email is disposable email\nreturn false;\n} else {\nreturn true;\n}\n}\n\npublic function free($email) {\nif ($this-&gt;CI-&gt;mailboxvalidator1-&gt;is_email_free($email) == true) {\n\/\/ If is_email_free return true, means the email is free email\nreturn false;\n} else {\nreturn true;\n}\n}\n\n}\n\n?&gt;\n<\/code><\/pre>\n    <\/div>\n<\/div>\n\n<script type=\"text\/javascript\">\ndocument.addEventListener('DOMContentLoaded', function() {\n    \/\/ Initialize copy functionality for this specific snippet\n    const snippet = document.getElementById('betterdocs-code-snippet-b512eafc');\n    if (snippet && window.BetterDocsCodeSnippet) {\n        window.BetterDocsCodeSnippet.initCopyButton(snippet);\n    }\n});\n<\/script>\n\n\n\n<p class=\"wp-block-paragraph\">Next, in your form controller, add the function name into the set_rules array. For example, if you want to use the disposable function to validate an email, just add the disposable into the set_rules array like this:<\/p>\n\n\n\n<div class=\"betterdocs-code-snippet-wrapper theme-light betterdocs-code-snippet-c5b1393d\"\n     id=\"betterdocs-code-snippet-c5b1393d\"\n     data-language=\"javascript\"\n     data-copy-button=\"true\">\n\n            <div class=\"betterdocs-code-snippet-header betterdocs-file-preview-header\">\n        <div class=\"betterdocs-file-preview-left\">\n                            <div class=\"betterdocs-traffic-lights\">\n                    <span class=\"traffic-light traffic-light-red\"><\/span>\n                    <span class=\"traffic-light traffic-light-yellow\"><\/span>\n                    <span class=\"traffic-light traffic-light-green\"><\/span>\n                <\/div>\n            \n            <div class=\"betterdocs-file-info\">\n                \n                            <\/div>\n        <\/div>\n\n        <div class=\"betterdocs-file-preview-right\">\n                            <div class=\"betterdocs-code-snippet-copy-container\">\n                    <button class=\"betterdocs-code-snippet-copy-button\"\n                            type=\"button\"\n                            data-clipboard-target=\"#betterdocs-code-snippet-c5b1393d .betterdocs-code-snippet-code code\"\n                            aria-label=\"Copy code to clipboard\">\n                        <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <path d=\"M16 1H4C2.9 1 2 1.9 2 3V17H4V3H16V1ZM19 5H8C6.9 5 6 5.9 6 7V21C6 22.1 6.9 23 8 23H19C20.1 23 21 22.1 21 21V7C21 5.9 20.1 5 19 5ZM19 21H8V7H19V21Z\" fill=\"currentColor\"\/>\n                        <\/svg>\n                    <\/button>\n                                    <\/div>\n                    <\/div>\n        <\/div>\n    \n    <div class=\"betterdocs-code-snippet-content\">\n        \n        <pre class=\"betterdocs-code-snippet-code language-javascript\"><code>$this-&gt;form_validation-&gt;set_rules(&#039;email&#039;, &#039;Email&#039;, &#039;required|disposable&#039;, array(&#039;disposable&#039; =&gt; &#039;A disposable email address is detected.&#039;));<\/code><\/pre>\n    <\/div>\n<\/div>\n\n<script type=\"text\/javascript\">\ndocument.addEventListener('DOMContentLoaded', function() {\n    \/\/ Initialize copy functionality for this specific snippet\n    const snippet = document.getElementById('betterdocs-code-snippet-c5b1393d');\n    if (snippet && window.BetterDocsCodeSnippet) {\n        window.BetterDocsCodeSnippet.initCopyButton(snippet);\n    }\n});\n<\/script>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Please note that you will be required to edit the custom error message for it. Now you can open your form and try to enter a disposable email address to see the outcome. The form should return the error message for the disposable email.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now you can open your form and try to enter an invalid email address. An error message should be returned by the form.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><a href=\"https:\/\/www.mailboxvalidator.com\/resources\/wp-content\/uploads\/2018\/11\/codeigniter1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"787\" height=\"639\" src=\"https:\/\/www.mailboxvalidator.com\/resources\/wp-content\/uploads\/2018\/11\/codeigniter1.png\" alt=\"Example output of disposable email address\" class=\"wp-image-482\" srcset=\"https:\/\/www.mailboxvalidator.com\/resources\/wp-content\/uploads\/2018\/11\/codeigniter1.png 787w, https:\/\/www.mailboxvalidator.com\/resources\/wp-content\/uploads\/2018\/11\/codeigniter1-300x244.png 300w, https:\/\/www.mailboxvalidator.com\/resources\/wp-content\/uploads\/2018\/11\/codeigniter1-768x624.png 768w, https:\/\/www.mailboxvalidator.com\/resources\/wp-content\/uploads\/2018\/11\/codeigniter1-50x41.png 50w, https:\/\/www.mailboxvalidator.com\/resources\/wp-content\/uploads\/2018\/11\/codeigniter1-600x487.png 600w, https:\/\/www.mailboxvalidator.com\/resources\/wp-content\/uploads\/2018\/11\/codeigniter1-320x260.png 320w\" sizes=\"auto, (max-width: 787px) 100vw, 787px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><\/h2>\n\n\n\n<h2 class=\"wp-block-heading has-text-align-center m-bottom-5\">Get started with MailboxValidator<\/h2>\n\n\n\n<p class=\"has-text-align-center m-bottom-5 is-size-20 wp-block-paragraph\">Improve your email deliverability and sender reputation in email marketing.<\/p>\n\n\n\n<p class=\"has-text-align-center m-bottom-5 is-size-20 wp-block-paragraph\">Register today and clean your email lists for <strong>FREE<\/strong>!<\/p>\n\n\n\n<p class=\"has-text-align-center wp-block-paragraph\"><a class=\"maxbutton-1 maxbutton maxbutton-sign-up-bulk-trial\" target=\"_blank\" title=\"No Setup Fee. Sign Up Trial Today!\" rel=\"noopener\" href=\"https:\/\/www.mailboxvalidator.com\/plans#mailboxvalidator-freesignup\"><span class='mb-text'>GET STARTED FOR FREE<\/span><\/a><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n","protected":false},"excerpt":{"rendered":"<p>Overview In this tutorial, we will demonstrate how to use the MailboxValidator CodeIgniter library to validate email addresses. The MailboxValidator [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"doc_category":[69],"doc_tag":[],"class_list":["post-2218","docs","type-docs","status-publish","hentry","doc_category-technical-articles"],"year_month":"2026-07","word_count":406,"total_views":"3","reactions":{"happy":"0","normal":"0","sad":"0"},"author_info":{"name":"mbv_editor","author_nicename":"mbv_editor","author_url":"https:\/\/www.mailboxvalidator.com\/resources\/author\/mbv_editor\/"},"doc_category_info":[{"term_name":"Technical Articles","term_url":"https:\/\/www.mailboxvalidator.com\/resources\/article-categories\/technical-articles\/"}],"doc_tag_info":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to use MailboxValidator CodeIgniter library to validate email? -<\/title>\n<meta name=\"description\" content=\"Use MailboxValidator CodeIgniter library to validate email easily, especially during form registration and processing.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.mailboxvalidator.com\/resources\/articles\/how-to-use-mailboxvalidator-codeigniter-library-to-validate-email\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to use MailboxValidator CodeIgniter library to validate email? -\" \/>\n<meta property=\"og:description\" content=\"Use MailboxValidator CodeIgniter library to validate email easily, especially during form registration and processing.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.mailboxvalidator.com\/resources\/articles\/how-to-use-mailboxvalidator-codeigniter-library-to-validate-email\/\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/mailboxvalidator\" \/>\n<meta property=\"article:modified_time\" content=\"2026-07-29T08:30:43+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.mailboxvalidator.com\/resources\/wp-content\/uploads\/2020\/01\/mbv_articles_img5.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"600\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@MailBoxV\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.mailboxvalidator.com\\\/resources\\\/articles\\\/how-to-use-mailboxvalidator-codeigniter-library-to-validate-email\\\/\",\"url\":\"https:\\\/\\\/www.mailboxvalidator.com\\\/resources\\\/articles\\\/how-to-use-mailboxvalidator-codeigniter-library-to-validate-email\\\/\",\"name\":\"How to use MailboxValidator CodeIgniter library to validate email? -\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mailboxvalidator.com\\\/resources\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.mailboxvalidator.com\\\/resources\\\/articles\\\/how-to-use-mailboxvalidator-codeigniter-library-to-validate-email\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mailboxvalidator.com\\\/resources\\\/articles\\\/how-to-use-mailboxvalidator-codeigniter-library-to-validate-email\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mailboxvalidator.com\\\/resources\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/mbv_articles_img5-600x300.png\",\"datePublished\":\"2018-11-29T00:00:00+00:00\",\"dateModified\":\"2026-07-29T08:30:43+00:00\",\"description\":\"Use MailboxValidator CodeIgniter library to validate email easily, especially during form registration and processing.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.mailboxvalidator.com\\\/resources\\\/articles\\\/how-to-use-mailboxvalidator-codeigniter-library-to-validate-email\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.mailboxvalidator.com\\\/resources\\\/articles\\\/how-to-use-mailboxvalidator-codeigniter-library-to-validate-email\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mailboxvalidator.com\\\/resources\\\/articles\\\/how-to-use-mailboxvalidator-codeigniter-library-to-validate-email\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.mailboxvalidator.com\\\/resources\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/mbv_articles_img5.png\",\"contentUrl\":\"https:\\\/\\\/www.mailboxvalidator.com\\\/resources\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/mbv_articles_img5.png\",\"width\":1200,\"height\":600,\"caption\":\"How-to-use-MailboxValidator-CodeIgniter-library-to-validate-email\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.mailboxvalidator.com\\\/resources\\\/articles\\\/how-to-use-mailboxvalidator-codeigniter-library-to-validate-email\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.mailboxvalidator.com\\\/resources\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Knowledge Base\",\"item\":\"https:\\\/\\\/www.mailboxvalidator.com\\\/resources\\\/articles\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How to use MailboxValidator CodeIgniter library to validate email?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.mailboxvalidator.com\\\/resources\\\/#website\",\"url\":\"https:\\\/\\\/www.mailboxvalidator.com\\\/resources\\\/\",\"name\":\"MailboxValidator Articles\",\"description\":\"MailboxValidator Articles\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.mailboxvalidator.com\\\/resources\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.mailboxvalidator.com\\\/resources\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.mailboxvalidator.com\\\/resources\\\/#organization\",\"name\":\"MailboxValidator\",\"url\":\"https:\\\/\\\/www.mailboxvalidator.com\\\/resources\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mailboxvalidator.com\\\/resources\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.mailboxvalidator.com\\\/resources\\\/wp-content\\\/uploads\\\/2017\\\/11\\\/cropped-mailboxvalidator-fb-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.mailboxvalidator.com\\\/resources\\\/wp-content\\\/uploads\\\/2017\\\/11\\\/cropped-mailboxvalidator-fb-logo.png\",\"width\":1199,\"height\":399,\"caption\":\"MailboxValidator\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mailboxvalidator.com\\\/resources\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/mailboxvalidator\",\"https:\\\/\\\/x.com\\\/MailBoxV\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/mailboxvalidator\\\/\",\"https:\\\/\\\/www.pinterest.com\\\/mailboxvalidator\\\/\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCesIP5V7nXRXthaqdjjfCFg\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to use MailboxValidator CodeIgniter library to validate email? -","description":"Use MailboxValidator CodeIgniter library to validate email easily, especially during form registration and processing.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.mailboxvalidator.com\/resources\/articles\/how-to-use-mailboxvalidator-codeigniter-library-to-validate-email\/","og_locale":"en_US","og_type":"article","og_title":"How to use MailboxValidator CodeIgniter library to validate email? -","og_description":"Use MailboxValidator CodeIgniter library to validate email easily, especially during form registration and processing.","og_url":"https:\/\/www.mailboxvalidator.com\/resources\/articles\/how-to-use-mailboxvalidator-codeigniter-library-to-validate-email\/","article_publisher":"https:\/\/www.facebook.com\/mailboxvalidator","article_modified_time":"2026-07-29T08:30:43+00:00","og_image":[{"width":1200,"height":600,"url":"https:\/\/www.mailboxvalidator.com\/resources\/wp-content\/uploads\/2020\/01\/mbv_articles_img5.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_site":"@MailBoxV","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.mailboxvalidator.com\/resources\/articles\/how-to-use-mailboxvalidator-codeigniter-library-to-validate-email\/","url":"https:\/\/www.mailboxvalidator.com\/resources\/articles\/how-to-use-mailboxvalidator-codeigniter-library-to-validate-email\/","name":"How to use MailboxValidator CodeIgniter library to validate email? -","isPartOf":{"@id":"https:\/\/www.mailboxvalidator.com\/resources\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.mailboxvalidator.com\/resources\/articles\/how-to-use-mailboxvalidator-codeigniter-library-to-validate-email\/#primaryimage"},"image":{"@id":"https:\/\/www.mailboxvalidator.com\/resources\/articles\/how-to-use-mailboxvalidator-codeigniter-library-to-validate-email\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mailboxvalidator.com\/resources\/wp-content\/uploads\/2020\/01\/mbv_articles_img5-600x300.png","datePublished":"2018-11-29T00:00:00+00:00","dateModified":"2026-07-29T08:30:43+00:00","description":"Use MailboxValidator CodeIgniter library to validate email easily, especially during form registration and processing.","breadcrumb":{"@id":"https:\/\/www.mailboxvalidator.com\/resources\/articles\/how-to-use-mailboxvalidator-codeigniter-library-to-validate-email\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.mailboxvalidator.com\/resources\/articles\/how-to-use-mailboxvalidator-codeigniter-library-to-validate-email\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mailboxvalidator.com\/resources\/articles\/how-to-use-mailboxvalidator-codeigniter-library-to-validate-email\/#primaryimage","url":"https:\/\/www.mailboxvalidator.com\/resources\/wp-content\/uploads\/2020\/01\/mbv_articles_img5.png","contentUrl":"https:\/\/www.mailboxvalidator.com\/resources\/wp-content\/uploads\/2020\/01\/mbv_articles_img5.png","width":1200,"height":600,"caption":"How-to-use-MailboxValidator-CodeIgniter-library-to-validate-email"},{"@type":"BreadcrumbList","@id":"https:\/\/www.mailboxvalidator.com\/resources\/articles\/how-to-use-mailboxvalidator-codeigniter-library-to-validate-email\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.mailboxvalidator.com\/resources\/"},{"@type":"ListItem","position":2,"name":"Knowledge Base","item":"https:\/\/www.mailboxvalidator.com\/resources\/articles\/"},{"@type":"ListItem","position":3,"name":"How to use MailboxValidator CodeIgniter library to validate email?"}]},{"@type":"WebSite","@id":"https:\/\/www.mailboxvalidator.com\/resources\/#website","url":"https:\/\/www.mailboxvalidator.com\/resources\/","name":"MailboxValidator Articles","description":"MailboxValidator Articles","publisher":{"@id":"https:\/\/www.mailboxvalidator.com\/resources\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.mailboxvalidator.com\/resources\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.mailboxvalidator.com\/resources\/#organization","name":"MailboxValidator","url":"https:\/\/www.mailboxvalidator.com\/resources\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mailboxvalidator.com\/resources\/#\/schema\/logo\/image\/","url":"https:\/\/www.mailboxvalidator.com\/resources\/wp-content\/uploads\/2017\/11\/cropped-mailboxvalidator-fb-logo.png","contentUrl":"https:\/\/www.mailboxvalidator.com\/resources\/wp-content\/uploads\/2017\/11\/cropped-mailboxvalidator-fb-logo.png","width":1199,"height":399,"caption":"MailboxValidator"},"image":{"@id":"https:\/\/www.mailboxvalidator.com\/resources\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/mailboxvalidator","https:\/\/x.com\/MailBoxV","https:\/\/www.linkedin.com\/company\/mailboxvalidator\/","https:\/\/www.pinterest.com\/mailboxvalidator\/","https:\/\/www.youtube.com\/channel\/UCesIP5V7nXRXthaqdjjfCFg"]}]}},"_links":{"self":[{"href":"https:\/\/www.mailboxvalidator.com\/resources\/wp-json\/wp\/v2\/docs\/2218","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mailboxvalidator.com\/resources\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/www.mailboxvalidator.com\/resources\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/www.mailboxvalidator.com\/resources\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mailboxvalidator.com\/resources\/wp-json\/wp\/v2\/comments?post=2218"}],"version-history":[{"count":2,"href":"https:\/\/www.mailboxvalidator.com\/resources\/wp-json\/wp\/v2\/docs\/2218\/revisions"}],"predecessor-version":[{"id":2524,"href":"https:\/\/www.mailboxvalidator.com\/resources\/wp-json\/wp\/v2\/docs\/2218\/revisions\/2524"}],"wp:attachment":[{"href":"https:\/\/www.mailboxvalidator.com\/resources\/wp-json\/wp\/v2\/media?parent=2218"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/www.mailboxvalidator.com\/resources\/wp-json\/wp\/v2\/doc_category?post=2218"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/www.mailboxvalidator.com\/resources\/wp-json\/wp\/v2\/doc_tag?post=2218"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}