email example for CI4 |
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. |
Messages In This Thread |
email example for CI4 - by carlkyo - 06-24-2020, 05:25 AM
RE: email example for CI4 - by Chroma - 06-29-2020, 09:04 AM
RE: email example for CI4 - by ivantcholakov - 06-29-2020, 02:04 PM
RE: email example for CI4 - by carlkyo - 07-02-2020, 02:48 AM
RE: email example for CI4 - by mlurie - 07-17-2020, 06:46 AM
|