(02-11-2016, 12:14 AM)skunkbad Wrote: (02-10-2016, 11:27 PM)acheng16 Wrote: Hi all, currently really stumped.... For some reason no matter what I try I cannot get this attachment loaded on to an email to send. If I pass in a bad path the email will send without the attachment but if I pass in the correct url the email just doesn't send and I don't get anything printed out either when i try the print_debugger.
Here is a code_snippet of what I'm doing
Code:
log_message('debug', 'screening is not blank');
// Get custom email content
$this->_ci->load->model('contents_model');
//$this->_ci->contents_model->initialize();
$this->_ci->contents_model->slug = 'screening-certificate-email';
$user_data['custom_content'] = $this->_ci->contents_model->load(true);
// send feedback PDF
$file_path = CERTIFICATE_FILE_PATH . '/' . $screening->slug . '.pdf';
$this->_ci->load->library('email');
$this->_ci->email->from('xxxxxxxxxxx');
$this->_ci->email->to($email);
$this->_ci->email->subject('Your Requested Certificate from ' . SITE_NAME);
$this->_ci->email->message($this->_ci->load->view('public/email/certificate', $user_data, TRUE));
log_message('debug', $_SERVER['DOCUMENT_ROOT']);
$this->_ci->email->attach($file_path);
log_message('debug' , $this->_ci->email->print_debugger());
log_message('debug', $file_path);
The file_path equates to /var/downloads/certificates/xxxx.pdf
Any thoughts or help would be much appreciated thank you!
I believe the output of print_debugger is an array, and cannot be sent to log unless converted to string, so you might try to json_encode it.
Code:
DEBUG - 2016-02-11 09:46:30 --> in send certificate
DEBUG - 2016-02-11 09:46:30 --> email is not blank
DEBUG - 2016-02-11 09:46:30 --> Model Class Initialized
DEBUG - 2016-02-11 09:46:30 --> screening is not blank
DEBUG - 2016-02-11 09:46:30 --> Model Class Initialized
INFO - 2016-02-11 09:46:30 --> Email Class Initialized
DEBUG - 2016-02-11 09:46:30 --> File loaded: application/views/[b]public[/b]/email/inc$
DEBUG - 2016-02-11 09:46:30 --> File loaded: application/views/[b]public[/b]/email/inc$
DEBUG - 2016-02-11 09:46:30 --> File loaded: application/views/[b]public[/b]/email/cer$
DEBUG - 2016-02-11 09:46:30 --> /var/screenu-www/screenu-web
Good point but with that being said if I look in the log it just gets stuck after the email attach?