SMTP Error: Could not connect to SMTP host

SMTP Error: Could not connect to SMTP host

by Juan Antonio Torres -
Number of replies: 8
Hi to all.

I write this post because I need desperately your help.

I have installed Moodle 1.9.7 in a Virtual Server with Red Hat 5.4, Apache 2, PHP 5 and an Oracle Database.

The only thing that I need to solve, because it is really important for our platform is to send mail to users via smtp. It is necessary for email auttentication.

We are in an Administration Building and have and use without any problems two potential smtp servers.

I have tried different ways to configure the smtp host but I have not be able to do it. For each attempt I get differents errors but the emails are never send out.

Now I am going to show you three differents attempts with respective error messages:

1. Configuring smtp host via Moodle. (Images 1 and 2)

2. Configuring the other smtp host via Moodle. (Images 3 and 4)

3. Leaving de smtp_host paramenter blank. (Images 5 and 6).

I´ll be grateful for your help.




Average of ratings: -
In reply to Juan Antonio Torres

Re: SMTP Error: Could not connect to SMTP host

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
From the command line (forget Moodle for now)....


$ telnet mail.juntadeandalucia.es 25


What happens?

This is to check if your server actually has access to the email server. If it times out then you have a network connectivity problem, a firewall problem or the configuration of the mail server is blocking access.

If it connects then you might need to authenticate (username and password required)
In reply to Howard Miller

Re: SMTP Error: Could not connect to SMTP host

by Juan Antonio Torres -
Thank so much for your response Howard.

I did it before but I don´t wrote it in my post.

Trying 10.240.225.171...
Connected to mail.juntadeandalucia.es (10.240.225.171).
Escape character is '^]'.

In reply to Juan Antonio Torres

Re: SMTP Error: Could not connect to SMTP host

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Keep going with telnet and make sure you can actually send a message from the machine.... the smtp setup might be restricting the connection in some way, so ensure it works "end to end".

Example (done on Windows but makes no difference)...

http://www.activexperts.com/activemail/telnet/
In reply to Howard Miller

Re: SMTP Error: Could not connect to SMTP host

by Pablo Villazon -

Hi

I´m using smtp gmail account for try to send email, but I get same ERROR SMTP Error: Could not connect to SMTP host, I´m not sure if smtp of gmail is accpeting this request, but if you find any server smtp, please let me know.

Thanks a lot.

Pablo

In reply to Howard Miller

Re: SMTP Error: Could not connect to SMTP host

by Guillermo Guichal -
I have the same problem. In the telnet session (from Windows, following the instructions on the link) I get a "No unauthenticated relaying permitted" error message :

> 220 ESMTP Thu, 08 Apr 2010 09:40:06 -0400: UCE strictly prohibited
> helo moodle
> 250 ... Hello moodle [IP]
> mail from: moodle@fpga.com.ar
> 550 bosauthsmtp10: Host IP: No unauthenticated relaying permitted

> Connection to host lost

I understand user and pass are used for authentication and they work alright from Thunderbird. I used the same setting in my moodle installation but I get the "Could not connect to SMTP server" error.

I set the debug level to "DEVELOPER" and got the following messages when trying to create a new user (and moodle tried to send an e-mail)

Warning: fsockopen() [function.fsockopen]: SSL operation failed with code 1. OpenSSL Error messages: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol in /tmp/lock/moodle/lib/phpmailer/class.smtp.php on line 106

Warning: fsockopen() [function.fsockopen]: Failed to enable crypto in /tmp/lock/moodle/lib/phpmailer/class.smtp.php on line 106

Warning: fsockopen() [function.fsockopen]: unable to connect to ssl://mail.fpga.com.ar:25 (Unknown error) in /tmp/lock/moodle/lib/phpmailer/class.smtp.php on line 106
ERROR: SMTP Error: Could not connect to SMTP host.


Any ideas or solutions?

Thanks, Guillermo


In reply to Guillermo Guichal

Re: SMTP Error: Could not connect to SMTP host

by Alejandro Michavila Pallarés -

Hello all,

Following the docs:

http://docs.moodle.org/en/Email_processing

http://docs.moodle.org/en/Email_setup_gmail

http://docs.moodle.org/en/Email_settings

I could send emails from Moodle using my gmail account, but that was using Moodle 2.0 P4, after Moodle 2.0 RC1 installation with the same mail configuration, I couldn't send mails, it stoped working.

Any ideas?.

In reply to Juan Antonio Torres

Re: SMTP Error: Could not connect to SMTP host

by Sonic Dx -

I just fixed a same issue. And I would like to contribute another possibility.

The DNS for my server is down. So server can't find the smtp server at all. Sounds very simple but it took me much time.

In Linux, after vi /etc/resolve.conf and restart network. You have to restart apache too. otherwise, it moodle still can not use the newly defined DNS.

Hope that would help somebody.