untuk configuration email menggunakan SMPTP saya menggunakan PHP MAILER dengan bentuk valuenya adalah array associative
<?php
namespace app\controllers;
use app\controllers\email\mailer; #panggil class mailer
use MiniMvc\Apps\Core\Bootstraping\Controller;
class gambar extends Controller
{
public function __construct()
{
// code here
}
public function confirmasi_password()
{
// data yang akan dikirim ke template email
$email = [
"to" =>"miyuki@gmail.com",
"subject" => "confirmasi email",
"message" => "hello worl",
"header" => "ini headernya",
];
// load template emailnya dan passing datanya
$view = mailer::confirmation($email);
// dump($view);
smptp_mail([
"to" => "hello@mail.com",
"subject" => "this is subject",
"message" => "this is message",
"header" => "this is header",
"template" => $view
]);
}
}Style Template
ketika melakukan style, dan di template view email terdapat variabel tidak aktif, karena di kirim melalui controller yang berbeda.
solution :
definisikan routingnya
aktifkan view() pada method mailer.php
check melalui url untuk melihat hasilnya
Last updated