Welcome Guest, Not a member yet? Register   Sign In
SMTP problem ( same as codeigniter 3)
#1

Hi ,sorry for english , thi is my function to send email to recover password with smtp :

PHP Code:
  public function send_new_password_by_mail($email_to,$newpassword)
  {
      $email = \Config\Services::email();

      $configuration = new \Config\Common();


      $config_smtp['protocol'] = 'smtp';
      $config_smtp['SMTPHost'] = 'authsmtp.securemail.pro';
      $config_smtp['SMTPUser'] = 'xxxxxxxxxx';
      $config_smtp['SMTPPass'] = 'xxxxxxxxxx';
      $config_smtp['SMTPPort'] = 465;
      $config_smtp['SMTPCrypto'] = 'ssl';

      $email->initialize($config_smtp);

      
      $email
->setMailType('html');
      $email->setFrom($configuration->siteName$configuration->siteEmail);
      $email->setTo($email_to);

      //$email->cc('[email protected]');
      //$email->bcc('[email protected]');


      $email->setSubject('Reset Password ' $configuration->siteName);

      $message '
      <html>
      <head>
          <title></title>
      </head>
      <body>

          <p>Ricevi questa mail perche` hai chiesto un reset della password sul sito '
.$configuration->siteName.'<p>
          
          <p>La tua nuova password e\' : '
.$newpassword.'<p>
          
          
          <p>Esegui il login cliccando  <a href="'
base_url().'/login">qui</a> <p>


          
          <p>Se hai ricevuto questa mail per sbaglio non considerarla<p>
          
          <a href="'
.$configuration->siteUrl .'">'.$configuration->siteUrl.' <p>


      </body>
      </html>'
;

      $email->setMessage($message);

      if ($email->send()) {


          return TRUE;
          
      
}else{

          return $email->printDebugger();
      

The method return TRUE but no mail are send . In codeigniter 3 i must use phpmailer (with same credential work fine) . Must i use phpmailer in codeigniter 4 too ?
Reply


Messages In This Thread
SMTP problem ( same as codeigniter 3) - by pippuccio76 - 01-22-2021, 05:11 AM



Theme © iAndrew 2016 - Forum software by © MyBB