Halo agan dan aganwati yang berbahagia :seneng
Lagi galau gara gara liat mantan jalan sama pacarnya :mad, iseng iseng nulis script buat ngilangin galaunya :lemes
Alhasil dapet 1 gan, kodenya sederhana, cuman kirim email dari localhost agan :malu
disimak yah, ini pake php model OOP (pake class & function) :seneng
gimana, sederhana kan? :ngakak :cambuk
Lagi galau gara gara liat mantan jalan sama pacarnya :mad, iseng iseng nulis script buat ngilangin galaunya :lemes
Alhasil dapet 1 gan, kodenya sederhana, cuman kirim email dari localhost agan :malu
disimak yah, ini pake php model OOP (pake class & function) :seneng
class email{ public $conf = array(); function __construct($email){ $this->from($email); } function to($to){ $this->conf['to'] = $to; } function from($from){ $this->conf['from'] = $from; } function subject($subject){ $this->conf['subject'] = $subject; } function mailContent($content){ $this->conf['content'] = $content; } function cek(){ if(!isset($this->conf['to']) || !isset($this->conf['content'])){ return false; }else{ if(!isset($this->conf['subject'])){$this->conf['subject']='';} return true; } } function sendMail(){ if($this->cek()){ $to = $this->conf['to']; $from = $this->conf['from']; $subject = $this->conf['subject']; $content = $this->conf['content']; $header = 'From: ' .$from. "\r\n". 'Reply-To: ' .$from. "\r\n" . 'X-Mailer: PHP/' . phpversion(); $notif = 'failed'; if(mail($to, $subject, $content, $header)){ $notif = 'mail send'; }; echo $notif; } } } /* To send email with this class ------------------------------ */ $emailAgan = "email_agan@gmail.com"; $target = "email_tujuan@gmail.com"; $me = new email($emailAgan); $me->to($target); $me->subject('test email'); $me->mailContent('testing'); $me->sendMail();
gimana, sederhana kan? :ngakak :cambuk
ajib gan, ane penggemar setia agan loohh, I luph you :*
BalasHapuswkwkw, siape elu -_- :cambuk
Hapuswuiiik :o keren pak (y) :D
BalasHapuswkwkw, makane sinau sing pinter :p
Hapus