<?php class HasMxTest extends PHPUnit_Framework_TestCase { /** * Set up for tests in this file. * * @access private */ private function setupTest() { $this->validator = new \EmailValidator\Validator(); } /** * Test hasMx * * @cover \EmailValidator\Validator::hasMx */ public function testHasMx() { $this->setupTest(); // Not an email $this->assertNull( $this->validator->hasMx('example.com') ); // No Records $this->assertFalse( $this->validator->hasMx('example@example.com') ); // Records $this->assertTrue( $this->validator->hasMx('example@google.com') ); $this->assertTrue( $this->validator->hasMx('example@yahoo.com') ); } }
This is a PHP email verification library, friends who need it can download and use
All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: admin@php.cn
Related Article

17 Apr 2025
I encountered a tough problem when developing a project that needs to process mail: how to efficiently manage mailboxes, get and delete mail. After trying multiple methods, I found that the php-imap/php-imap library not only solves my problem, but also greatly improves the efficiency and stability of the program.

09 Sep 2025
Python's verification-email library does not indicate that verification failed by throwing an exception, but instead returns a boolean value through its core function verify_email() (True means valid, False means invalid). This article will provide detailed instructions on how to correctly utilize this mechanism to handle email verification results through conditional judgments rather than trying to catch non-existent VerifyEmailError exceptions.

16 May 2025
The best ways to send emails using PHP include: 1. Use PHP's mail() function to basic sending; 2. Use PHPMailer library to send more complex HTML mail; 3. Use transactional mail services such as SendGrid to improve reliability and analysis capabilities. With these methods, you can ensure that emails not only reach the inbox, but also attract recipients.

08 Sep 2025
This article aims to clarify the correct use of the Python verification-email library, especially when processing email address verification results. Many developers may mistakenly think that the library will throw a VerifyEmailError exception when verification fails, but in reality, it indicates the verification result by returning a boolean value True or False. Understanding this design helps avoid AttributeError and enables the verification logic of email addresses in a concise and effective way.

17 Oct 2024
Easiest Form Validation Library for PHPIn search of a straightforward PHP library that simplifies form validation tasks? Let's explore your options:Custom Library ExampleThe user suggests a custom PHP class that incorporates predefined regex patterns

22 Oct 2024
This article provides debugging solutions for issues encountered when using PHP mail() or PHPMailer to send emails. It addresses errors related to the mail() function and the missing PHPMailer class import. The article suggests enabling SMTP debuggin


Hot Tools

php-Mailer mail class
php-Mailer mail class

PHPMailer_v5.1 mail class
PHPMailer_v5.1 mail class
