Having a problem with smtp module

pinenut - November 7, 2009 - 16:58

I am running drupal under Fedora 10 and xampp.

When I boot Fedora, I get the following message:

Starting XAMPP for Linux 1.7.2...

XAMPP: Starting Apache with SSL (and PHP5)...

XAMPP: Starting MySQL...

XAMPP: Starting ProFTPD...

XAMPP for Linux started.

So, I know ssl is working, but I am not sure if tsl is something else.

With the smtp configuration of drupal....

smtp server: smtp.google.com
port: 586
encrypte protocol: TSL

While sending a test e-mail, I got these error messages:

* warning: fsockopen() [function.fsockopen]: unable to connect to smtp.google.com:587 (Connection timed out) in /opt/lampp/drupal/sites/all/modules/smtp/phpmailer/class.smtp.php on line 122.
* warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /opt/lampp/drupal/sites/all/modules/smtp/phpmailer/class.smtp.php on line 122.
* warning: fsockopen() [function.fsockopen]: unable to connect to :587 (php_network_getaddresses: getaddrinfo failed: Name or service not known) in /opt/lampp/drupal/sites/all/modules/smtp/phpmailer/class.smtp.php on line 122.
* Unable to send e-mail. Please contact the site administrator if the problem persists.

What could be causing these errors?

Assuming you want to use

John Morahan - November 7, 2009 - 20:46

Assuming you want to use Gmail: try smtp.gmail.com instead of smtp.google.com

That was the answer!

pinenut - November 8, 2009 - 02:34

Thank you for pointing out that error.

I did not realize this until you pointed it out for me.
This simple error took me a whole day to solve.

[SOLVED] Had to change a few lines in phpmailer/class.smtp.php

pinenut - November 8, 2009 - 02:36

I saw a simple, yet neat workaround at this site ( http://deepakssn.blogspot.com/2006/06/gmail-php-send-email-using-php-wit... )

I am using phpmailer 2.2.1 and added two lines just before line 104 of class.smtp.php as follows.

$host = "ssl://smtp.gmail.com";
$port = 465;

I am not sure if this trick is the best solution, but it did the trick for me.
Now I am able to send emails through smtp.gmail.com.

Note:

It turned out to be a real work around a mistake I made.
I used a wrong server name, namely smtp.google.com instead of smtp.gmail.com.
After all I did not have to change anything....

 
 

Drupal is a registered trademark of Dries Buytaert.