Topic on Project:Support desk

HELP!Failed to send email:ssl://smtp.gmail.com:465 [SMTP: Failed to connect socket: Connection timed out (code: -1, response: )]

13
Rachel1208 (talkcontribs)

Firstly, I write this in Localsettings: //2014-5-20 ---smtp,email $wgSMTP = array(

       'host' => 'ssl://smtp.gmail.com',
       'IDHost' => 'gmail.com',
       'port' => 465,
       'username' => 'myaddressg@gmail.com', 
       'password' => 'mypsw',
       'auth' => true
    );

And then I do this : install pear mail install pear net_smtp

Unfortunately, the wiki shows that error message as: Failed to connect to ssl://smtp.gmail.com:465 [SMTP: Failed to connect socket: Connection timed out (code: -1, response: )]

I do this later according to some advice from others: sudo pear install Auth_SASL2-0.1.0 sudo pear install mail_mime sudo apt-get install postfix

The error message never disappear.

I try the whole process in two new server, and the mail function never work successfully.

Can anyone help me ? Thank you a million !!!

Rachel1208 (talkcontribs)

UPDATE: I write this instead of configuration of gmail: $wgSMTP = array(

       'host' => 'ssl://smtp.163.com',
       'IDHost' => '163.com',
       'port' => 25,
       'username' => 'myaddress@163.com', 
       'password' => 'mypsw',
       'auth' => true
    );

The error message is : Failed to connect to ssl://smtp.163.com:25 [SMTP: Failed to connect socket: Connection refused (code: -1, response: )]

I really do not know what should I do....help....help...help...

Rachel1208 (talkcontribs)

The lonely me update lonelyRachel1208 (talk)

gege@gege-ThinkCentre-M58p:~/mediawiki-1.22.4-0$ telnet smtp.gmail.com 465 Trying 173.194.79.108... ^C gege@gege-ThinkCentre-M58p:~/mediawiki-1.22.4-0$ telnet smtp.gmail.com 465 Trying 74.125.25.109... Trying 74.125.25.108... Trying 2607:f8b0:400e:c01::6d... telnet: Unable to connect to remote host: Network is unreachable

Regards~

Rachel1208 (talkcontribs)

Hi, I think I find the problem,but have no idea to solve it: When I use the network of mine, everthing becomes ok. When I use the network of the company, the error message shows as I metioned above. When I use the Intranet of the company, it shows: telnet: could not resolve smtp.gmail.com/465: Name or service not known.

The email function is very important for my company's wiki, and the wiki must use Intranet to make the website safe. Hope my views do not confuse you. Could you please give me some advice to solve the problem? Thanks a lot!

Ciencia Al Poder (talkcontribs)

"smtp.gmail.com/465" is not a valid domain name. When using telnet to connect you need to specify telnet smtp.gmail.com 465 and not telnet smtp.gmail.com/465

If it works for home but not in your company network, the problem is a firewall that's blocking access to smtp.gmail.com on port 465 (or just any connection to port 465). Contact your network administrator.

Rachel1208 (talkcontribs)

Thank you for your reply firstly! And in fact, I write telnet smtp.gmail.com 465 but the result shows telnet: could not resolve smtp.gmail.com/465: Name or service not known.

And what should the administrator does? Close the firewall?

Thank you again! :)

Ciencia Al Poder (talkcontribs)

try first doing a ping to smtp.gmail.com. If your host can't resolve that domain name, you have a DNS problem.

About what the administrator should do, that's not really important for you if you can't fix it yourself. Simply tell him your problem: from your host you can't contact smtp.gmail.com at port 465, and the administrator would know what to do (usually, open that port in the firewall for outgoing connections).

Rachel1208 (talkcontribs)

Hi , thank you for your kind reply. And yes, it failed because of the firewall. Unfortunately, the service at 465 cam not be opened for some reason. And I wonder know, whether the wiki can use SSMTP instead of SMTP? Then what should I do? Just install ssmtp and change the related content in "localsettings,php" such as: $wgSSMTP = array(

'host' => 'ssl://ssmtp.gmail.com', 'IDHost' => 'mycompany.com', 'port' => 25, 'username' => 'myaddressg@mycompany.com', 'password' => 'mypsw', 'auth' => true ); ?? I am looking forward to your reply! Thank you again and again~

Ciencia Al Poder (talkcontribs)

With the ssl:// protocol on the host, you're already saying you're using SSL to send to SMTP instead of plain text, so it should work fine.

You should try to connect to that port from any utility software to check if the port is open, like a simple telnet smtp.gmail.com 465

103.51.217.60 (talkcontribs)

<?php include "emails/PHPMailer/PHPMailerAutoload.php";

   //Create a new PHPMailer instance

$mail = new PHPMailer(); $mail->IsSMTP(); $mail->SMTPDebug = 1; $mail->SMTPAuth = true; $mail->SMTPSecure = 'ssl'; $mail->Host = "smtp.gmail.com"; $mail->Port = 465; $mail->IsHTML(true);

   //Username to use for SMTP authentication

$mail->Username = "@gmail.com"; $mail->Password = "";

   //Set who the message is to be sent from

$mail->setFrom('mzubim@gmail.com', 'Zubair Mushtaq');

   //Set an alternative reply-to address

$mail->addReplyTo('replyto@gmail.com', 'Secure Developer');

   //Set who the message is to be sent to

$mail->addAddress('abulogics@gmail.com', 'Abulogicss');

   //Set the subject line

$mail->Subject = 'PHPMailer SMTP test';

   //Read an HTML message body from an external file, convert referenced images to embedded,
   //convert HTML into a basic plain-text alternative body

$mail->msgHTML("convert HTML into a basic plain-text alternative body");

   //Replace the plain text body with one created manually

$mail->AltBody = 'This is a plain-text message body';

   //send the message, check for errors

if (!$mail->send()) { echo "Mailer Error: " . $mail->ErrorInfo; } else { echo "Message sent!"; }

14.98.194.86 (talkcontribs)

hi i m recieving the same problem even turning off the firewall

Failed to connect to ssl://smtp.gmail.com:465 [SMTP: Failed to connect socket: fsockopen(): unable to connect to ssl://smtp.gmail.com:465 (Unknown error) (code: -1, response: )]

14.98.194.86 (talkcontribs)

if somebody can help it will be great

Ciencia Al Poder (talkcontribs)

Please check with netcat or telnet if you have connectivity through that port, to be sure there's no other firewall between your server and gmail blocking the connection. It may be your ISP.