(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.