-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.php
45 lines (37 loc) · 967 Bytes
/
test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
include __DIR__ . '/autoload.php';
if (!isset($argv[1])) {
throw new \Exception ('Email is not set');
}
$email = $argv[1];
// validate email
$valid = \EmailChecker\Validator::validateEmail ($email);
if (!$valid) {
throw new \Exception ('Invalid email.');
}
// get host from email
$host = \EmailChecker\Validator::getHostFromEmail ($email);
// dig it
$lookup = new \EmailChecker\Lookup ($host);
// get mx records
$mx = $lookup->getMxRecords();
// telnet
$telnet = new \EmailChecker\Telnet($mx[0]);
// say helo
$helo = $telnet->sayHelo();
if (!$helo) {
$telnet = new \EmailChecker\Telnet($mx[0]);
$telnet->sayHelo('openovate.com');
}
// set mail from
$telnet->mailFrom('[email protected]');
// set receive to
$telnet->rcptTo($email);
if($host == 'yahoo.com') {
$telnet->data();
$telnet->addHeader('Subject', 'test');
$telnet->setBody('This is a test');
}
// check
echo $telnet->check() . "-";
//echo $telnet->getResponse();