SMTP problem ( same as codeigniter 3) |
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) 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 ?
(01-22-2021, 09:45 AM)demyr Wrote: Si, puoi usarlo anche con il CI 4.*Ciao demyr .... I install the phpmailer library in ThirdParty , change the namespace as namespace App\ThirdParty\phpmailer\src\PHPMailer\PHPMailer; in PHPMailer,SMTP,EXCEPTION,OAuth in controller where i must use : use App\ThirdParty\phpmailer\src\PHPMailer\PHPMailer\PHPMailer; use App\ThirdParty\phpmailer\src\PHPMailer\PHPMailer\Exception; use App\ThirdParty\phpmailer\src\PHPMailer\PHPMailer\SMTP; but i have this error : Class 'App\ThirdParty\phpmailer\src\PHPMailer\PHPMailer\PHPMailer' not found
Ciao di nuovo,
Upload the PHP Mailer folder at the same level with app-public-system etc folders. Autoload PHP: PHP Code: public $psr4 = [ Create a Controller with a name, per esempio, Sendmail.php PHP Code: <?php namespace App\Controllers; To show the success message within your view: PHP Code: <?php if (session('msg')) : ?> The message box is made with Bootstrap, you can change it easily. Hope it works Cordiali Saluti
oh, GOD.
app/Config/Autoload.php property $psr4 add a pair (namespace => path) PHP Code: 'PHPMailer\PHPMailer' => APPPATH . 'ThirdParty/phpmailer/src' In a controller PHP Code: use PHPMailer\PHPMailer\PHPMailer
(01-22-2021, 02:00 PM)iRedds Wrote: oh, GOD. I dont want autoload phpmailer but use or only where i want use why the class aren't round?
The Email class in CodeIgniter 4 is a barely-changed port from version 3. There is a complete rewrite in the works but for now it is likely any problems you had using the CI3 version will persist in CI4.
That said I use the Email class daily without trouble, so you might just need to give it some more effort.
(01-25-2021, 06:11 AM)MGatner Wrote: The Email class in CodeIgniter 4 is a barely-changed port from version 3. There is a complete rewrite in the works but for now it is likely any problems you had using the CI3 version will persist in CI4.I found the problem , It s a server problem about sender if i use a link as name the class ( or the server) dont send the mail |
Welcome Guest, Not a member yet? Register Sign In |