【发布时间】:2017-01-06 16:57:51
【问题描述】:
我的 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>
我的控制器 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');
}
当我点击提交时电子邮件无法发送但如果我替换$to = $_POST['email']; to$to = myemail@gmail.com;`
它能够发送电子邮件。请帮忙...
【问题讨论】:
-
兄弟尝试回应您的帖子并评论所有其他代码以检查您是否获得帖子价值
-
在您的表单操作中 email_invoice 之后还有一件事是“/”
-
您也可以转储整个
$_POST数组以查看您得到了什么,并知道其中是否包含email。
标签: php codeigniter