CodeIgniter Forums
Pec email - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forum-11.html)
+--- Thread: Pec email (/thread-79399.html)



Pec email - pippuccio76 - 06-09-2021

HI , sorry for english i try to send pec from my webapp with codeigniter 3 :

PHP Code:
$this->load->library('email');

    $config['protocol'] = 'smtp';
    $config['mailPath'] = '/usr/sbin/sendmail';
    $config['charset']  'iso-8859-1';
    $config['wordWrap'] = true;
    
    $config
['smtp_crypto'] = 'ssl';
    $config['mailtype'] = 'html';
    $config['SMTPHost'] = 'smtps.pec.aruba.it';
    $config['SMTPUser'] = '[email protected]';
    $config['SMTPPass'] = 'xxxxxxxx';
    $config['SMTPPort'] = 465;

    $this->email->initialize($config);

    $this->email->from('[email protected]''[email protected]');

    $this->email->to('[email protected]');



      $this->email->subject('Prove Pec Stefano ' );

      $message '
      <html>
      <head>
          <title></title>
      </head>
      <body>
          <p>Prova composizione pec <p>


      </body>
      </html>'
;

      $this->email->message($message);

      if ($this->email->send()) {

          echo 'Inviata';
          //return TRUE;

      }else{

          //return $email->printDebugger();
          echo  $this->email->print_debugger();
      


This is the error : 
Code:
You did not specify a SMTP hostname.
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.

Wath can i do ?


RE: Pec email - InsiteFX - 06-09-2021

Is this wrong?
PHP Code:
$config['SMTPHost'] = 'smtps.pec.aruba.it';

// should it be
$config['SMTPHost'] = 'smtp.pec.aruba.it'



RE: Pec email - pippuccio76 - 06-09-2021

(06-09-2021, 08:58 PM)InsiteFX Wrote: Is this wrong?
PHP Code:
$config['SMTPHost'] = 'smtps.pec.aruba.it';

// should it be
$config['SMTPHost'] = 'smtp.pec.aruba.it'

It s the config parametri get by site


RE: Pec email - InsiteFX - 06-10-2021

Ok, I see what it is now, I do not think that CodeIgniter can handle that.
I did find this library that you should be able to use.
PHP PEC Email Library