Created
January 24, 2016 23:23
-
-
Save stnight/e055f8a1df2b27d09b94 to your computer and use it in GitHub Desktop.
This is a controller, please follow this pattern, it always work for me
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Sender extends CI_Controller { | |
public function __construct() // to remember use public | |
{ | |
parent::__construct(); | |
$this->load->helper('url'); | |
} | |
public function home() { | |
$this->load->library('email'); // load email library | |
$this->email->set_newline("\r\n"); | |
$this->email->from('cictpracticum2015@gmail.com', 'Sample Po'); | |
$this->email->to('earljohn3ric@gmail.com'); | |
$this->email->subject('Sample'); | |
$this->email->attach('/var/www/html/sample.txt'); | |
$message = "Mahal ko si Char and Mahal ako ni Char :D"; | |
$this->email->message($message); | |
if ($this->email->send()){ | |
echo "Mail Sent!"; | |
} else { | |
show_error($this->email->print_debugger()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment