codeigniter电子邮件附件

时间:2017-01-08 12:04:31

标签: php codeigniter

我有一个发送电子邮件的工作表单......现在我想添加附件。

我在视图文件中有这个..

 <form  action="<?php echo base_url() ?>admin/order/email_invoice/<?php echo   $invoice_info->invoice_no ?>" id="formid" method="POST"  >

    <center> <input type = "text" name="email" value="" class="form-control" placeholder="Customer Email Address"  /></center>


    </div>
      <div class="modal-footer">
    <button type="submit" name="submit" class="btn btn-info " >Email to Customer</button></div>

    </div>

</form>

我在控制器中有这个..

 //sender email
        $to = $_POST['email'];

        //subject
        $subject = 'Invoice no:' . $id;
        $attachment = $_FILES['attachment'];
        // 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!');

我想将此链接附加到表单,以便将pdf文件发送到控制器并通过电子邮件发送此文件作为附件。我该怎么做?请帮助..

<?php echo base_url() ?>admin/order/pdf_invoice/<?php echo $invoice_info->invoice_no ?>

1 个答案:

答案 0 :(得分:0)

试试这个:

select *
from your_table
where 2003 between start_year and coalesce(end_year, 9999); -- a large year value