Reza
Reza

Reputation: 1

How to check whether port 465 is closed or not in Cpanel?

I have a problem with my new hosting company. I can't send Emails trough port 465. As you know port 465 used for secure SMTP service and if closed user can't send Emails from external email accounts like Yahoo! or Gmail. For example when I trying to send Email via PHPMailer I receive this Error:

Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

Now my question is how to check whether port 465 is closed or not in Cpanel? I use http://portquiz.net/ website and it shows that port 465 is blocked. Whats the easiest way to prove the hosting company that they blocked port 465. Thanks.

Upvotes: 0

Views: 3489

Answers (2)

Shiv Singh
Shiv Singh

Reputation: 7211

if your service provider using CSF firewall than by default always on blocked condition so you should contact your service provider to remove from blocked list.

You can use below php script to scan all mail ports.

<?php

$ports[] = array('host'=>'interspire.smtp.com','number'=>25);
$ports[] = array('host'=>'interspire.smtp.com','number'=>2525);
$ports[] = array('host'=>'interspire.smtp.com','number'=>25025);
$ports[] = array('host'=>'helpme.interspire.smtp.com','number'=>80);

$ports[] = array('host'=>'google.com','number'=>80);
$ports[] = array('host'=>'smtp.gmail.com','number'=>587);
$ports[] = array('host'=>'smtp.gmail.com','number'=>465);
$ports[] = array('host'=>'pop.gmail.com','number'=>995);
$ports[] = array('host'=>'imap.gmail.com','number'=>993);

$ports[] = array('host'=>'ftp.mozilla.org','number'=>21);
$ports[] = array('host'=>'smtp2go.com','number'=>8025);

$ports[] = array('host'=>'relay.dnsexit.com','number'=>25);
$ports[] = array('host'=>'relay.dnsexit.com','number'=>26);
$ports[] = array('host'=>'relay.dnsexit.com','number'=>940);
$ports[] = array('host'=>'relay.dnsexit.com','number'=>8001);
$ports[] = array('host'=>'relay.dnsexit.com','number'=>2525);
$ports[] = array('host'=>'relay.dnsexit.com','number'=>80);

$ports[] = array('host'=>'mail.authsmtp.com','number'=>23);
$ports[] = array('host'=>'mail.authsmtp.com','number'=>25);
$ports[] = array('host'=>'mail.authsmtp.com','number'=>26);
$ports[] = array('host'=>'mail.authsmtp.com','number'=>2525);

foreach ($ports as $port)
{
    //$connection = @fsockopen($port['host'], $port['number']);
    $connection = @fsockopen($port['host'], $port['number'], $errno, $errstr, 5); // 5 second timeout for each port.

    if (is_resource($connection))
    {
        echo '<h2>' . $port['host'] . ':' . $port['number'] . ' ' . '(' . getservbyport($port, 'tcp') . ') is open.</h2>' . "\n";

        fclose($connection);
    }

    else
    {
        echo '<h2>' . $port['host'] . ':' . $port['number'] . ' is not responding.</h2>' . "\n";
    }
}


?>

Code written by interspire

Upvotes: 1

abkrim
abkrim

Reputation: 3692

For check if on your Cpanel server has port closed by firewall try this:

iptables -L -n |grep [PORT]
# For your question 
iptables -L -n |grep 465

Port 465 it's unoficial for SMTP

Upvotes: 0

Related Questions