Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (!defined('BASEPATH'))exit('No direct script access allowed');
- class KirimEmail extends CI_Controller {
- public function __construct() {
- parent::__construct();
- $this->load->helper('form');
- $this->load->library('form_validation');
- $this->load->library('encrypt');
- }
- // Send Gmail to another user
- public function index() {
- $sender_email = "rizalubuntuuser@gmail.com";
- $user_password = "rahasiaqu";
- $receiver_email = "rizalubuntuuser@gmail.com";
- $username = 'Rizal';
- $subject = 'tes kirim email';
- $message = '<b>tes kirim email dari ane</b>';
- $config['protocol'] = 'smtp';
- $config['smtp_host'] = 'ssl://smtp.googlemail.com';
- $config['smtp_port'] = 465;
- $config['smtp_user'] = $sender_email;
- $config['smtp_pass'] = $user_password;
- // Load email library and passing configured values to email library
- $this->load->library('email', $config);
- $this->email->set_newline("\r\n");
- // Sender email address
- $this->email->from($sender_email, $username);
- // Receiver email address
- $this->email->to($receiver_email);
- // Subject of email
- $this->email->subject($subject);
- // Message in email
- $this->email->message($message);
- if ($this->email->send()) {
- echo 'Email Successfully Send !';
- } else {
- echo '<p class="error_msg">Invalid Gmail Account or Password !</p>';
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement