<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Testmail extends CI_Controller {

    public function index()
    {
        $this->load->library('email');

        $this->email->from('fakethis889@gmail.com', 'NOKA NOSIN');
        $this->email->to('email_tujuanmu@gmail.com'); // ubah ke email penerima nyata
        $this->email->subject('Tes Kirim Email - NOKA NOSIN');
        $this->email->message('<h3>Testing kirim email via Gmail SMTP berhasil!</h3>');

        if ($this->email->send()) {
            echo "✅ <b>Email berhasil dikirim!</b>";
        } else {
            echo "❌ <b>Email gagal dikirim!</b><br><pre>";
            print_r($this->email->print_debugger(['headers']));
            echo "</pre>";
        }
    }
}
