email example for CI4 |
Hi All, I am Tom and I am a newbie to any framework but I love to learning Codeigniter.
I followed the tutorial below but not work, I had tried gmail and and other mail server https://www.tutsmake.com/send-email-in-c...with-smtp/ Is there any mail example or PHPMailer example for CI4 many thanks and hope you everything is well I am trying to make PHPMailer as a helper PHP Code: <?php
What problem are you having?
Your question only says it doesn't work. Have you tried to make it work without it being a helper? Just direct from within the Controller?
In the article how to use CodeIgniter's Email class is described. You are showing an attempt for using PHPMailer. Why are you trying to load its classes manually? Maybe you would need to read PHPMaier's documentation?
I want some tutorial about phpmailer on CI 4. I had searched a lot and I didn't find it.
Laravel is popular and lots of resources but now I just have done with the code below thanks all PHP Code: use PHPMailer\PHPMailer\Exception;
Tom,
I am also relatively new to CodeIgniter. In the past I have always used PHPMailer too, but CI4's mail class is just as good and easier to implement within the framework. The first thing you should do is set your mail server's configuration in App\Config\Email.php using $protocol, $SMTPHost, $SMTPUser, $SMTPPass, $SMTPPort, and $SMTPCrypto. Alternatively, you can simply add the following to your .env file: Code: #-------------------------------------------------------------------- Use email.SMTPPort = '587' and email.SMTPCrypto = 'tls' if your mail server uses TLS instead of SSL. Here is a simple code snippet that takes POST data from a mail form and sends it as an e-mail to the specified recipient: PHP Code: //Expecting $_POST['Name', 'Email', 'Phone', 'Message'] I hope this helps you get started. |
Welcome Guest, Not a member yet? Register Sign In |