07-24-2015, 08:33 PM
(This post was last modified: 07-25-2015, 08:24 PM by wolfgang1983.)
I have created a email.php config file in
application > config > email.php
I would like to know if I load $this->load->library('email');
Does it detect the config email.php automatic?
application > config > email.php
application > config > email.php
I would like to know if I load $this->load->library('email');
Does it detect the config email.php automatic?
PHP Code:
public function send() {
$this->load->library('form_validation');
$this->form_validation->set_rules('subject', 'E-Mail Subject', 'required');
$this->form_validation->set_rules('message', 'E-Mail Message', 'required');
if ($this->form_validation->run() == FALSE) {
$this->index();
} else {
$this->load->library('email');
switch ($this->input->post('to')) {
case 'newsletter':
$results = $this->get_news_letter_emails();
foreach ($results as $result) {
$this->email->from(config_item('email'), config_item('website_name'));
$this->email->to($result['email']);
$this->email->subject($this->input->post('subject'));
$this->email->message($this->input->post('message'));
$this->email->send();
}
$this->session->set_flashdata('success', 'Email Sent Success');
redirect('admin/mail');
break;
}
}
application > config > email.php
PHP Code:
<?php
$config['protocol'] = 'smtp';
$config['smtp_host'] = '***';
$config['smtp_port'] = 465;
$config['smtp_user'] = '***';
$config['smtp_pass'] = '***';
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!