Reputation: 85
Controller
public function index(){
send_mail('New Volunteer Form received', $this->load->view('site/email/volunteer', NULL, TRUE));
}
Helper Function
Below helper function and use send email function send_mail($subject, $message) {
/* @var $CI CI_Controller */
$CI = &get_instance();
$CI->load->library('upload');
$CI->load->library('email');
$CI->email->from('[email protected]', 'Hello');
$CI->email->to('[email protected]');
$CI->email->subject($subject);
$CI->email->message($message);
$CI->email->set_mailtype('html');
$CI->email->attach(base_url() . 'uploads/volunteer/');
return $CI->email->send();
}
View
<td>Photo</td>
<td style="text-align: center"><img src="<?php base_url() ?>uploads/volunteer/<?php echo $_POST['userfile']; ?>" height="100" width="150"></td>
</tr>
Upvotes: 0
Views: 1876
Reputation: 38652
Try this
$this->email->attach('/path/to/photo1.jpg', 'inline');
or
$message = '<td>Photo</td>';
$message .= '<td style="text-align: center">';
$message .= '<img src="<?php base_url() ?>uploads/volunteer/<?php echo $_POST['."userfile".']; ?>" height="100" width="150">';
$message .= '</td></tr>';
To use the default disposition (attachment), leave the second parameter blank, otherwise use a custom disposition
Upvotes: 1