Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Problem with Email class
  • Hello, first sory for my english i'm french.
    I try to use the email class with the smtp protocol but I have a error when connect to the server Here is my call:
    private function _send_email($addr)
    {
     $option = array(
      'useragent' => 'Sitetest',
      'protocol' => 'smtp',
      'smtp_host' => 'ssl://smtp.mail.yahoo.fr',
      'smtp_user' => 'my_username',
      'smtp_pass' => 'my_password',
      'smtp_port' => 465,
      'smtp_timeout' => 5,
      'crlf' => "\r\n",
      'newline' => "\r\n",
      'wordwrap' => true,
      'wrapchars' => 76,
      'mailtype' => 'text',
      'charset' => 'utf-8',
      'validate' => true,
      'force_multipart' => false
     );
     $email = Email::factory($option);
     $email->from('my_adress', 'Sitetest');
     $email->to($addr);
     $email->subject('Formulaire de contact');
     $email->message('Votre formulaire de contact a bien été pris en compte... Merci.');
     if (!$email->send())
     {
      throw new Exception($email->print_debugger());
     }
    }
    

    the error in the log is :
    Error - 2011-02-09 09:18:02 --> 2 - fsockopen&#40;&#41; [<a href='function.fsockopen'>function.fsockopen</a>]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /home/www-dev/isaya.fr/fuel/core/classes/email/smtp.php on line 128
    Error - 2011-02-09 09:18:02 --> 2 - fsockopen&#40;&#41; [<a href='function.fsockopen'>function.fsockopen</a>]: unable to connect to ssl://smtp.mail.yahoo.fr:465 (php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution) in /home/www-dev/isaya.fr/fuel/core/classes/email/smtp.php on line 128
    Error - 2011-02-09 09:18:02 --> 2 - fwrite() expects parameter 1 to be resource, boolean given in /home/www-dev/isaya.fr/fuel/core/classes/email/smtp.php on line 277
    Error - 2011-02-09 09:18:02 --> 2 - fgets() expects parameter 1 to be resource, boolean given in /home/www-dev/isaya.fr/fuel/core/classes/email/smtp.php on line 300
    Error - 2011-02-09 09:18:02 --> 2 - fwrite() expects parameter 1 to be resource, boolean given in /home/www-dev/isaya.fr/fuel/core/classes/email/smtp.php on line 277
    Error - 2011-02-09 09:18:02 --> 2 - fgets() expects parameter 1 to be resource, boolean given in /home/www-dev/isaya.fr/fuel/core/classes/email/smtp.php on line 300
    Error - 2011-02-09 09:18:02 --> 0 -  in /home/www-dev/isaya.fr/fuel/app/classes/controller/contact.php on line 67
    

    This parameter works in codeigniter so i don't understand...
    Can you tell me when i'm wrong... Thanks.
  • I resolv my problem but the smtp port is hard coded: in fuel/core/classes/email/smtp.php function _smtp_connect:
      $this->_smtp_connect = fsockopen&#40;
       $this->smtp_vars['host'],
       [b]25, //Here[/b]
       $errno,
       $errstr,
       $this->smtp_vars['timeout']
      &#41;;
    
    it would be this: $this->smtp_vars if it can help it's work
  • Thanks for posting a solution. will be merged to the core

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion