Mengirim Email dengan PHPMailer di YII Framework 1
Mengirim Email dengan PHPMailer di YII Framework 1
Halo, langsung saja.
  1. download extensi PHPMailer yii di https://www.yiiframework.com/extension/phpmailer
  2. Masuk ke Contoller , di controller :

public function actionCreate()


$model=new Register;

//$this->layout = “print2”;

// Uncomment the following line if AJAX validation is needed

// $this->performAjaxValidation($model);




$verivi=12345; // saya menentukan pasword user yang mendaftar.



    if($model->email == Yii::app()->db->createCommand(‘select email from register where email like “%’.$model->email.’%” limit 1′)->queryScalar()) {











    $toemail = “admin@hehe.org”; 

                $pesan   = “Hai
Anda telah melakukan register dengan :

      Username  :”.$model->email.”

      Password  :”.$verivi; //isi email


                $email = ‘admin@hehe.org’; //email pengirim, silahkan diganti dengan email sendiri

                $password = ‘paswordmu’; //password gmail

                $to_id = $toemail;

                $message = $pesan;

                $subject = ‘Sukses Registrasi www.hehe.org’;

                $mail = new PHPMailer;

                $mail->FromName = “No-reply [ www.hehe.org ]”;


                $mail->Host = ‘mail.hehe.com’;//masukan host email anda

                $mail->Port = 25;

                $mail->SMTPSecure = ‘tls’;

                $mail->SMTPAuth = false;


                $mail->Username = $email;

                $mail->Password = $password;


                $mail->Subject = $subject;









hasilnya :
sekian, semoga bermanfaat.

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top