PHP 5.3 CodeIgniter Gmail SMTP Zaman Aşımı

0 Cevap php

Ben yakın zamana kadar bir sorun olmadan CodeIgniter'ı kullanarak yazdığı web uygulaması e-posta göndermek için Gmail SMTP kullanmak var. Bu benim kod pasajı:

  $config['protocol']   = 'smtp';
  $config['smtp_host']  = $this->smtp_host;
  $config['smtp_port']  = $this->smtp_port;
  $config['smtp_user']  = $this->smtp_username;
  $config['smtp_pass']  = $this->smtp_password;
  $config['mailtype']   = $this->email_type;
  $config['newline'] = "\r\n";
  $this->load->library('email', $config);

  $this->email->from($email_sender, $email_sender_name);
  $this->email->to($email_to);
  $this->email->subject($message_subject);
  $this->email->message($message_content);
  $result = $this->email->send();

: I "ssl://smtp.gmail.com" ev sahibi olarak ve 465 liman olarak, ben günlüğünde bu hata var kullandığınızda

DEBUG - 2010-08-06 17:19:24 --> Email Class Initialized
ERROR - 2010-08-06 17:19:45 --> Severity: Warning  --> fsockopen(): unable to connect to ssl://smtp.googlemail.com:465 (Connection timed out) /data/donny/Projects/workspace/codeigniter/libraries/Email.php 1652
DEBUG - 2010-08-06 17:19:45 --> Language file loaded: language/english/email_lang.php
ERROR - 2010-08-06 17:19:45 --> Severity: Warning  --> fwrite() expects parameter 1 to be resource, boolean given /data/donny/Projects/workspace/codeigniter/libraries/Email.php 1795
ERROR - 2010-08-06 17:19:45 --> Severity: Warning  --> fgets() expects parameter 1 to be resource, boolean given /data/donny/Projects/workspace/codeigniter/libraries/Email.php 1818
ERROR - 2010-08-06 17:19:45 --> Severity: Warning  --> fwrite() expects parameter 1 to be resource, boolean given /data/donny/Projects/workspace/codeigniter/libraries/Email.php 1795
ERROR - 2010-08-06 17:19:45 --> Severity: Warning  --> fgets() expects parameter 1 to be resource, boolean given /data/donny/Projects/workspace/codeigniter/libraries/Email.php 1818
ERROR - 2010-08-06 17:19:45 --> Severity: Warning  --> fwrite() expects parameter 1 to be resource, boolean given /data/donny/Projects/workspace/codeigniter/libraries/Email.php 1795
ERROR - 2010-08-06 17:19:45 --> Severity: Warning  --> fgets() expects parameter 1 to be resource, boolean given /data/donny/Projects/workspace/codeigniter/libraries/Email.php 1818
ERROR - 2010-08-06 17:19:45 --> Severity: Warning  --> fwrite() expects parameter 1 to be resource, boolean given /data/donny/Projects/workspace/codeigniter/libraries/Email.php 1795
ERROR - 2010-08-06 17:19:45 --> Severity: Warning  --> fgets() expects parameter 1 to be resource, boolean given /data/donny/Projects/workspace/codeigniter/libraries/Email.php 1818
ERROR - 2010-08-06 17:19:45 --> Severity: Warning  --> fwrite() expects parameter 1 to be resource, boolean given /data/donny/Projects/workspace/codeigniter/libraries/Email.php 1795
ERROR - 2010-08-06 17:19:45 --> Severity: Warning  --> fwrite() expects parameter 1 to be resource, boolean given /data/donny/Projects/workspace/codeigniter/libraries/Email.php 1795
ERROR - 2010-08-06 17:19:45 --> Severity: Warning  --> fgets() expects parameter 1 to be resource, boolean given /data/donny/Projects/workspace/codeigniter/libraries/Email.php 1818

Bu ilişkili olmadığını bilmiyorum, ama PHP 5.3 içine benim PHP yükseltmeden önce, aynı kod sadece iyi çalıştı. Bu güvenlik duvarı veya internet bağlantı sorunları ise, ben hala Thunderbird gmail smtp kullanarak e-posta gönderebilirsiniz.

Ben çeşitli forumlarda baktıktan sonra, ben bu testi yapmak için bir ipucu var:

$ openssl s_client -starttls smtp -crlf -connect smtp.gmail.com:587
CONNECTED(00000003)
depth=1 /C=US/O=Google Inc/CN=Google Internet Authority
verify error:num=20:unable to get local issuer certificate
verify return:0
---
Certificate chain
 0 s:/C=US/ST=California/L=Mountain View/O=Google Inc/CN=smtp.gmail.com
   i:/C=US/O=Google Inc/CN=Google Internet Authority
 1 s:/C=US/O=Google Inc/CN=Google Internet Authority
   i:/C=US/O=Equifax/OU=Equifax Secure Certificate Authority
---
Server certificate
-----BEGIN CERTIFICATE-----
...cut...
-----END CERTIFICATE-----
subject=/C=US/ST=California/L=Mountain View/O=Google Inc/CN=smtp.gmail.com
issuer=/C=US/O=Google Inc/CN=Google Internet Authority
---
No client certificate CA names sent
---
SSL handshake has read 1901 bytes and written 335 bytes
---
New, TLSv1/SSLv3, Cipher is RC4-MD5
Server public key is 1024 bit
Compression: NONE
Expansion: NONE
SSL-Session:
    Protocol  : TLSv1
    Cipher    : RC4-MD5
    Session-ID: 2CA08CABBE21653238292DEDF30D119428970FAA284263C92480DA5283AFE013
    Session-ID-ctx: 
    Master-Key: B3F6D4423DC14E24E894D7AD7107B4A640839F2BF90233714EC5BF0D139611E65655902B50AEA3BD67373A21338526B0
    Key-Arg   : None
    Start Time: 1281086948
    Timeout   : 300 (sec)
    Verify return code: 20 (unable to get local issuer certificate)
---
250 ENHANCEDSTATUSCODES

test etmek için aynı aracı kullanırken ssl bağlantı bana zaman aşımı verin:

$ openssl s_client -ssl2 -crlf -connect smtp.gmail.com:465
connect: Connection timed out
connect:errno=110

Yukarıda benim kod noktası olarak ana ve 587 olarak "tls://smtp.gmail.com" kullanmayı deneyin, ama şimdi ben bu hata mesajını alıyorum:

DEBUG - 2010-08-06 17:26:10 --> Email Class Initialized
ERROR - 2010-08-06 17:26:10 --> Severity: Warning  --> fsockopen(): SSL operation failed with code 1. OpenSSL Error messages:
error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number /data/donny/Projects/workspace/codeigniter/libraries/Email.php 1652
ERROR - 2010-08-06 17:26:10 --> Severity: Warning  --> fsockopen(): Failed to enable crypto /data/donny/Projects/workspace/codeigniter/libraries/Email.php 1652
ERROR - 2010-08-06 17:26:10 --> Severity: Warning  --> fsockopen(): unable to connect to tls://smtp.googlemail.com:587 (Unknown error) /data/donny/Projects/workspace/codeigniter/libraries/Email.php 1652
DEBUG - 2010-08-06 17:26:10 --> Language file loaded: language/english/email_lang.php
ERROR - 2010-08-06 17:26:10 --> Severity: Warning  --> fwrite() expects parameter 1 to be resource, boolean given /data/donny/Projects/workspace/codeigniter/libraries/Email.php 1795
ERROR - 2010-08-06 17:26:10 --> Severity: Warning  --> fgets() expects parameter 1 to be resource, boolean given /data/donny/Projects/workspace/codeigniter/libraries/Email.php 1818
ERROR - 2010-08-06 17:26:10 --> Severity: Warning  --> fwrite() expects parameter 1 to be resource, boolean given /data/donny/Projects/workspace/codeigniter/libraries/Email.php 1795
ERROR - 2010-08-06 17:26:10 --> Severity: Warning  --> fgets() expects parameter 1 to be resource, boolean given /data/donny/Projects/workspace/codeigniter/libraries/Email.php 1818
ERROR - 2010-08-06 17:26:10 --> Severity: Warning  --> fwrite() expects parameter 1 to be resource, boolean given /data/donny/Projects/workspace/codeigniter/libraries/Email.php 1795
ERROR - 2010-08-06 17:26:10 --> Severity: Warning  --> fgets() expects parameter 1 to be resource, boolean given /data/donny/Projects/workspace/codeigniter/libraries/Email.php 1818
ERROR - 2010-08-06 17:26:10 --> Severity: Warning  --> fwrite() expects parameter 1 to be resource, boolean given /data/donny/Projects/workspace/codeigniter/libraries/Email.php 1795
ERROR - 2010-08-06 17:26:10 --> Severity: Warning  --> fgets() expects parameter 1 to be resource, boolean given /data/donny/Projects/workspace/codeigniter/libraries/Email.php 1818
ERROR - 2010-08-06 17:26:10 --> Severity: Warning  --> fwrite() expects parameter 1 to be resource, boolean given /data/donny/Projects/workspace/codeigniter/libraries/Email.php 1795
ERROR - 2010-08-06 17:26:10 --> Severity: Warning  --> fwrite() expects parameter 1 to be resource, boolean given /data/donny/Projects/workspace/codeigniter/libraries/Email.php 1795
ERROR - 2010-08-06 17:26:10 --> Severity: Warning  --> fgets() expects parameter 1 to be resource, boolean given /data/donny/Projects/workspace/codeigniter/libraries/Email.php 1818
  1. Can you help me find out what the cause of connection time out when I'm try to connect to ssl://smtp.gmail.com:465
  2. Second, can I use tls in PHP 5.3? If yes, can you show me the code, so I can put it into CodeIgniter and test it.

Teşekkürler.

0 Cevap