SMTP unable to connect

Started by willemjan, November 10, 2010, 08:41:53 AM

Previous topic - Next topic

willemjan

For a few days I am trying to make my forum send mails with SMTP. My host sais that the settings are right. They have run an diagnostic on the server and found no errors. This is the error I get:


2: fsockopen() [<a href='function.fsockopen'>function.fsockopen</a>]: unable to connect to mail.hervormddamwald.nl:26 (Connection timed out)


I have checked my settings multiple times... Allso contacted my host about it. They state that the settings are correct.

Any ideas?

Mitħrandir

Without other details it's hard to identify the problem.

In the error message you have reported I see that the SMTP port is 26, while the default server port for these connections is 25...
-- Mithrandir
Proud of using SMF 2.0 on http://polislife.netsons.org/forum

willemjan

Wich other details do you need?

Yes I have set the port to 26. I had it on 25 first, didn't work. Contacted my host and they said it should be port 26.

Mitħrandir

Quote from: willemjan on November 10, 2010, 10:21:36 AM
Wich other details do you need?
If you have some PHP knowledge, you could try doing some tests manually and see what happens.

The error message you have posted states that the PHP script failed to open a socket connection on the smtp server.
You may create a simple PHP script that tries to open such a connection:
Code (testSMTP.php) Select

<?php
$fp 
fsockopen("mail.hervormddamwald.nl"26$errno$errstr30);
if (!
$fp) {
    echo 
"$errstr ($errno)\n";
} else {
    echo 
"Connection established!\n";
    
fclose($fp);
}
?>

-- Mithrandir
Proud of using SMF 2.0 on http://polislife.netsons.org/forum

willemjan

No I don't know allot of php. I can mostly understand what an php script does tough.

I have used your script and this is what I get:

Warning: fsockopen() [function.fsockopen]: unable to connect to mail.hervormddamwald.nl:26 (Connection timed out) in /public/sites/www.hervormddamwald.nl/testsmtp.php on line 2
Connection timed out (110)

Mitħrandir

Some host have the fsckopen() function disabled.
This script prints out which features are enabled and other (useful) info.
Code (info.php) Select

<?php
phpinfo
();
?>


Look for entries related to sockets.

You can also ask your support desk about this.
-- Mithrandir
Proud of using SMF 2.0 on http://polislife.netsons.org/forum

willemjan

Don't know what I am looking for exactly, but I found this:

sockets
Sockets Support  enabled 

Mitħrandir

Quote from: Mitħrandir on November 10, 2010, 10:33:46 AM
You may create a simple PHP script that tries to open such a connection:
Code (testSMTP.php) Select

<?php
$fp 
fsockopen("mail.hervormddamwald.nl"26$errno$errstr30);
if (!
$fp) {
    echo 
"$errstr ($errno)\n";
} else {
    echo 
"Connection established!\n";
    
fclose($fp);
}
?>


I've tried this script on my local Apache+PHP installation and it works.

Try to submit your problem, that is related to fsckopen(), to your support desk.
Maybe your server has some security policies (you can't see them with phpinfo()) that block socket creation.
-- Mithrandir
Proud of using SMF 2.0 on http://polislife.netsons.org/forum

willemjan

Support request filed. Awaiting their answer.

willemjan

Well somehow it takes a while before they answer... In the meantime, is there anything else I could try?

LiroyvH

In the meanwhile, perhaps you can use php sendmail rather than SMTP?
((U + C + I)x(10 − S)) / 20xAx1 / (1 − sin(F / 10))
President/CEO of Simple Machines - Server Manager
Please do not PM for support - anything else is usually OK.

willemjan

Well my site is not live yet, so I have some time left to wait. The problem with PHP sendmail is that the mail sent from the site gets marked as spam. That's why I would like SMTP-mail.

willemjan

My (Dutch) host responds:

Quotehelaas niet meer mogelijk om d.m.v. PHP scripts functies zoals FTP, SMTP met gebruik van fsockopen() e.d. aan te roepen vanaf uw website.

Freely translated that means something like this: It's no longer possible to use functions as fsockopen() trought PHP-scripts for FTP and SMTP.

What should I do?

willemjan


willemjan

By examining the error again:

2: fsockopen() [<a href='function.fsockopen'>function.fsockopen</a>]: unable to connect to mail.hervormddamwald.nl:26 (Connection timed out)

I guess its impossible to send an email with this host, because they blocked fsockopen()? Or is there a work-around for this?

Deaks

~~~~
Former SMF Project Manager
Former SMF Customizer

"For as lang as hunner o us is in life, in nae wey
will we thole the Soothron tae owergang us. In truth it isna for glory, or wealth, or
honours that we fecht, but for freedom alane, that nae honest cheil gies up but wi life
itsel."

willemjan

you mean with PHP sendmail?

How can I set an emailadress? I have a few people that send newsletters now and then. They must be sent with the same email adress...

Deaks

one thing ive suggested to other users is maybe look at a mailing script like phplists, this will give you more control on how many you sent etc
~~~~
Former SMF Project Manager
Former SMF Customizer

"For as lang as hunner o us is in life, in nae wey
will we thole the Soothron tae owergang us. In truth it isna for glory, or wealth, or
honours that we fecht, but for freedom alane, that nae honest cheil gies up but wi life
itsel."

willemjan


Advertisement: