<?php

$host = 'email-smtp.us-east-1.amazonaws.com';
$ports = array(25, 465, 587);

foreach ($ports as $port) {
	$connection =  @fsockopen ($host, $port);

	if (is_resource($connection)) {
		echo '<h2>' . $host . ':' . $port . ' ' . '(' . getservbyport($port, 'tcp') . ') is open.</h2>' . "\n";
		fclose($connection);
	} // if
	else {
		echo '<h2>' . $host . ':' . $port . ' is not responding.</h2>' . "\n";
	} // else
} // foreach