Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function __construct(){
- parent::__construct();
- $this->load->library('MyPHPMailer');
- }
- function index(){
- $this->load->library('MyPHPMailer');
- $fromEmail = "myemail@gmail.com";
- $isiEmail = "Isi email tulis disini";
- $mail = new PHPMailer;
- $mail->IsHTML(true); // set email format to HTML
- $mail->IsSMTP(); // we are going to use SMTP
- $mail->SMTPAuth = true;
- $mail->SMTPSecure = "ssl";
- $mail->Host = "smtp.gmail.com";
- $mail->Port = 465;
- $mail->Username = $fromEmail;
- $mail->Password = "password";
- $mail->SetFrom('myemail@gmail.com', 'noreply');
- $mail->Subject = "Kirim Pesan PHPMailer";
- $mail->Body = $isiEmail;
- $toEmail = "emaildestination@gmail.com";
- $mail->AddAddress($toEmail);
- if(!$mail->Send()) {
- echo "Eror: ".$mail->ErrorInfo;
- } else {
- echo "Email success to be sent";
- }
- }
- class MyPHPMailer {
- public function __construct() {
- require('PHPMailer/PHPMailerAutoload.php');
- require('PHPMailer/class.phpmailer.php');
- }
- }
Add Comment
Please, Sign In to add comment