diff --git a/library_files/application/config/flexi_auth.php b/library_files/application/config/flexi_auth.php index a99b745..b67f318 100644 --- a/library_files/application/config/flexi_auth.php +++ b/library_files/application/config/flexi_auth.php @@ -609,6 +609,41 @@ * Note: If using 'text', the default code within the flexi auth templates use HTML which will be emailed as plain text. */ $config['email']['email_type'] = 'html'; + + /** + * The mail sending protocol. Options: 'mail', 'sendmail', 'smtp' + */ + $config['email']['protocol'] = 'mail'; + + /** + * SMTP Server Address. + */ + $config['email']['smtp_host'] = ""; + + /** + * SMTP Username. + */ + $config['email']['smtp_user'] = ""; + + /** + * SMTP Password. + */ + $config['email']['smtp_pass'] = ""; + + /** + * SMTP Port . For Gmail is 587 + */ + $config['email']['smtp_port'] = 25; + + /** + * SMTP Encryption. Can be "", "ssl","tls" + */ + $config['email']['smtp_crypto'] = ""; + + /** + * Enable Email debug. Debug information will be printed + */ + $config['email']['debug'] = FALSE; /** * Directory where email templates are stored. @@ -728,4 +763,4 @@ $config['messages']['target_user']['form_validation_duplicate_username'] = 'public'; /* End of file flexi_auth.php */ -/* Location: ./system/application/config/flexi_auth.php */ \ No newline at end of file +/* Location: ./system/application/config/flexi_auth.php */ diff --git a/library_files/application/models/flexi_auth_model.php b/library_files/application/models/flexi_auth_model.php index 661c5a3..37cbb1e 100644 --- a/library_files/application/models/flexi_auth_model.php +++ b/library_files/application/models/flexi_auth_model.php @@ -2307,14 +2307,37 @@ public function send_email($email_to = NULL, $email_title = NULL, $data = NULL, $this->load->library('email'); $this->email->clear(); - $this->email->initialize(array('mailtype' => $this->auth->email_settings['email_type'])); + + //Get all config data for email initialisation + $email_config = array( + 'mailtype' => $this->auth->email_settings['email_type'], + 'protocol' => $this->auth->email_settings['protocol'], + 'smtp_host' => $this->auth->email_settings['smtp_host'], + 'smtp_user' => $this->auth->email_settings['smtp_user'], + 'smtp_pass' => $this->auth->email_settings['smtp_pass'], + 'smtp_port' => $this->auth->email_settings['smtp_port'], + 'smtp_crypto' => $this->auth->email_settings['smtp_crypto'], + ); + + $this->email->initialize($email_config); $this->email->set_newline("\r\n"); $this->email->from($this->auth->email_settings['reply_email'], $this->auth->email_settings['site_title']); $this->email->to($email_to); $this->email->subject($this->auth->email_settings['site_title'] ." ". $email_title); $this->email->message($message); - - return $this->email->send(); + + // If debug optin is enabled print out the debug info + if($this->auth->email_settings['debug']) + { + $this->email->send(); + echo $this->email->print_debugger(); + + return TRUE; + } + else + { + return $this->email->send(); + } } /**