{"id":22300421,"url":"https://github.com/mailboxvalidator/mailboxvalidator-codeigniter","last_synced_at":"2025-07-29T02:31:48.314Z","repository":{"id":143961646,"uuid":"159461800","full_name":"MailboxValidator/mailboxvalidator-codeigniter","owner":"MailboxValidator","description":"MailboxValidator CodeIgniter library enable users to block disposal email, detect free email and validate if an email is valid","archived":false,"fork":false,"pushed_at":"2024-01-02T02:06:53.000Z","size":19,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-01-02T03:24:18.284Z","etag":null,"topics":["codeigniter","codeigniter-library","email-checker","email-validation","email-validator","email-verification","mailboxvalidator-api","mailboxvalidator-codeigniter"],"latest_commit_sha":null,"homepage":"https://www.mailboxvalidator.com","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MailboxValidator.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-11-28T07:30:48.000Z","updated_at":"2024-01-02T02:06:57.000Z","dependencies_parsed_at":"2024-01-02T03:34:26.304Z","dependency_job_id":null,"html_url":"https://github.com/MailboxValidator/mailboxvalidator-codeigniter","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MailboxValidator%2Fmailboxvalidator-codeigniter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MailboxValidator%2Fmailboxvalidator-codeigniter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MailboxValidator%2Fmailboxvalidator-codeigniter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MailboxValidator%2Fmailboxvalidator-codeigniter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MailboxValidator","download_url":"https://codeload.github.com/MailboxValidator/mailboxvalidator-codeigniter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227971950,"owners_count":17849421,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["codeigniter","codeigniter-library","email-checker","email-validation","email-validator","email-verification","mailboxvalidator-api","mailboxvalidator-codeigniter"],"created_at":"2024-12-03T18:10:53.702Z","updated_at":"2024-12-03T18:10:54.268Z","avatar_url":"https://github.com/MailboxValidator.png","language":"PHP","readme":"# MailboxValidator CodeIgniter Email Validation Package\n\nMailboxValidator CodeIgniter Email Validation Package enables user to easily validate if an email address is valid, a type of disposable email or free email.\n\nThis package can be useful in many types of projects, for example\n\n - to validate an user's email during sign up\n - to clean your mailing list prior to email sending\n - to perform fraud check\n - and so on\n\n\n\n## Installation\n\nUpload the ``libraries`` folder to your CodeIgniter ``application`` folder\n\n\n\n## Dependencies\n\nThis package will only work with CodeIgniter 3. For CodeIgniter 4, you can get it from [here](https://github.com/MailboxValidator/mailboxvalidator-codeigniter4).\n\nAn API key is required for this module to function.\n\nGo to https://www.mailboxvalidator.com/plans#api to sign up for FREE API plan and you'll be given an API key.\n\nAfter you get your API key, open your ``application/config/config.php`` and add the following line:\n```php\n$config['mbv_api_key'] = 'PASTE_YOUR_API_KEY_HERE';\n```\n\nYou can also set you api key in controller during calling library. Just do like this:\n\n```php\n$params = array('mbv_api_key' =\u003e 'PASTE_YOUR_API_KEY_HERE');\n$this-\u003eCI-\u003eload-\u003elibrary('mailboxvalidator',$params);\n```\n\n\n\n## Functions\n\n### getSingleResult(email_address)\n\nPerforms email validation on the supplied email address.\n\n#### Return Fields\n\n| Field Name | Description |\n|-----------|------------|\n| email_address | The input email address. |\n| domain | The domain of the email address. |\n| is_free | Whether the email address is from a free email provider like Gmail or Hotmail. Return values: True, False |\n| is_syntax | Whether the email address is syntactically correct. Return values: True, False |\n| is_domain | Whether the email address has a valid MX record in its DNS entries. Return values: True, False, -\u0026nbsp;\u0026nbsp;\u0026nbsp;(- means not applicable) |\n| is_smtp | Whether the mail servers specified in the MX records are responding to connections. Return values: True, False, -\u0026nbsp;\u0026nbsp;\u0026nbsp;(- means not applicable) |\n| is_verified | Whether the mail server confirms that the email address actually exist. Return values: True, False, -\u0026nbsp;\u0026nbsp;\u0026nbsp;(- means not applicable) |\n| is_server_down | Whether the mail server is currently down or unresponsive. Return values: True, False, -\u0026nbsp;\u0026nbsp;\u0026nbsp;(- means not applicable) |\n| is_greylisted | Whether the mail server employs greylisting where an email has to be sent a second time at a later time. Return values: True, False, -\u0026nbsp;\u0026nbsp;\u0026nbsp;(- means not applicable) |\n| is_disposable | Whether the email address is a temporary one from a disposable email provider. Return values: True, False, -\u0026nbsp;\u0026nbsp;\u0026nbsp;(- means not applicable) |\n| is_suppressed | Whether the email address is in our blacklist. Return values: True, False, -\u0026nbsp;\u0026nbsp;\u0026nbsp;(- means not applicable) |\n| is_role | Whether the email address is a role-based email address like admin@example.net or webmaster@example.net. Return values: True, False, -\u0026nbsp;\u0026nbsp;\u0026nbsp;(- means not applicable) |\n| is_high_risk | Whether the email address contains high risk keywords. Return values: True, False, -\u0026nbsp;\u0026nbsp;\u0026nbsp;(- means not applicable) |\n| is_catchall | Whether the email address is a catch-all address. Return values: True, False, Unknown, -\u0026nbsp;\u0026nbsp;\u0026nbsp;(- means not applicable) |\n| mailboxvalidator_score | Email address reputation score. Score \u003e 0.70 means good; score \u003e 0.40 means fair; score \u003c= 0.40 means poor. |\n| time_taken | The time taken to get the results in seconds. |\n| status | Whether our system think the email address is valid based on all the previous fields. Return values: True, False |\n| credits_available | The number of credits left to perform validations. |\n| error_code | The error code if there is any error. See error table in the below section. |\n| error_message | The error message if there is any error. See error table in the below section. |\n\n\n\n#### isDisposableEmail(email_address)\n\nCheck whether the email address is belongs to a disposable email provider or not. Return Values: True, False\n\n\n\n#### isFreeEmail(email_address)\n\nCheck whether the email address is belongs to a free email provider or not. Return Values: True, False\n\n\n\n## Usage\n\n### Form Validation\n\nTo use this library in form validation, first create a new file under ``application/libraries`` called ``MY_Form_validation.php``.\n\nAfter that, copy the following sample code into ``MY_Form_validation.php``:\n```php\n\u003c?php \nif (!defined('BASEPATH')) exit('No direct script access allowed');\n\nclass MY_Form_validation extends CI_Form_validation {\n\n\tprotected $CI;\n\tpublic function __construct(){\n    \n        $this-\u003eCI = \u0026get_instance();\n\t\t$this-\u003eCI-\u003eload-\u003elibrary('mailboxvalidator');\n\t}\n\n    public function disposable($email) {\n\t\tif ($this-\u003eCI-\u003emailboxvalidator-\u003eisDisposableEmail($email) == true) {\n\t\t\t// If is_email_disposable return true, means the email is disposable email\n\t\t\treturn false;\n\t\t} else {\n\t\t\treturn true;\n\t\t}\n\t}\n\n    public function free($email) {\n\t\tif ($this-\u003eCI-\u003emailboxvalidator-\u003eisFreeEmail($email) == true) {\n\t\t\t// If is_email_free return true, means the email is free email\n\t\t\treturn false;\n\t\t} else {\n\t\t\treturn true;\n\t\t}\n\t}\n\n}\n\n?\u003e\n```\n\nNext, 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 email, just add the ``disposable`` into the ``set_rules`` array. A sample code is displayed at below:\n\n```php\n\u003c?php\nclass Register extends CI_Controller\n{\n    public function __construct()\n    {\n         parent::__construct();\n         $this-\u003eload-\u003ehelper('form');\n         $this-\u003eload-\u003ehelper('url');\n         $this-\u003eload-\u003elibrary('form_validation');\n    }\n    \n    public function index()\n    {\n        $data['username'] = $this-\u003einput-\u003epost('username');\n        $this-\u003eform_validation-\u003eset_rules('username', 'Username', 'required');\n        $this-\u003eform_validation-\u003eset_rules('password', 'Password', 'required');\n        $this-\u003eform_validation-\u003eset_rules('passconf', 'Password Confirmation', 'required');\n        $this-\u003eform_validation-\u003eset_rules('email', 'Email', 'required|disposable', array('disposable' =\u003e 'A disposable email address is detected.'));\n        if ($this-\u003eform_validation-\u003erun() == FALSE)\n        {\n                $this-\u003eload-\u003eview('register');\n        }\n        else\n        {\n                $this-\u003eload-\u003eview('sucess',$data);\n        }\n    }\n    \n    \n}\n```\n\nNoted that you will be required to add a 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.\n\n### Email Validation\n\nTo use this library to get validation result for an email address, firstly load the library in your controller like this:\n```php\n$this-\u003eload-\u003elibrary('mailboxvalidator');\n```\nAfter that, you can get the validation result for the email address like this:\n```php\n$result = $this-\u003emailboxvalidator-\u003egetSingleResult('test@example.com');\n```\nTo pass the result to the view, just simply add the $result to your view loader like this:\n```php\n$this-\u003eload-\u003eview('YOUR_VIEW_NAME',$result);\n```\nAnd then in your view file, call the validation results. For example:\n```php\necho $email_address;\n```\nYou can refer the full list of response parameters at above table.\n\n\n## Errors\n\n| error_code | error_message         |\n| ---------- | --------------------- |\n| 100        | Missing parameter.    |\n| 101        | API key not found.    |\n| 102        | API key disabled.     |\n| 103        | API key expired.      |\n| 104        | Insufficient credits. |\n| 105        | Unknown error.        |\n\n\n\n## Copyright\n\nCopyright (C) 2018-2024 by MailboxValidator.com, support@mailboxvalidator.com","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmailboxvalidator%2Fmailboxvalidator-codeigniter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmailboxvalidator%2Fmailboxvalidator-codeigniter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmailboxvalidator%2Fmailboxvalidator-codeigniter/lists"}