I have this in my order_invoice.php
enter code here
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#myModal">Email to Customer</button>
<!-- Modal -->
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">× </button>
<form action="<?php echo base_url() ?>admin/order/email_invoice/" method="POST" >
<center> <input
class="form-control"
name="email"
placeholder="Customer Email Address"
type= <?php echo form_input('email', set_value('email', '')); ?> /></center>
</div>
<div class="modal-footer">
<a href="<?php echo base_url() ?>admin/order/email_invoice/<?php echo $invoice_info->invoice_no ?>" type="submit" name="submit" class="btn btn-info " >Email to Customer</a></div>
</form>
and i have this in my controller order.php
//sender email
$to = $_POST['email'];
//subject
$subject = 'Invoice no:' . $id;
// set view page
$view_page = $this->load->view('admin/order/pdf_order_invoice', $data, true);
$send_email = $this->mail->sendEmail($from, $to, $subject, $view_page);
if ($send_email) {
$this->message->custom_success_msg('admin/order/order_invoice/' . $id,
'Your email has been send successfully!');
} else {
$this->message->custom_error_msg('admin/order/order_invoice/' . $id,
'Sorry unable to send your email!');
}
}else{
$this->message->custom_error_msg('admin/order/order_invoice/' . $id,
'Sorry unable to send your email, without company email');
}
When i click submit the email not able to sent but if i replace $to = $_POST['email']; to$to = [email protected];`
it able to sent the email. Please help ...
$_POSTarray to see what you get, and know that is containemailor not. - Yahya