Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/260.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在codeigniter中获取电子邮件功能的输入数据_Php_Codeigniter - Fatal编程技术网

Php 在codeigniter中获取电子邮件功能的输入数据

Php 在codeigniter中获取电子邮件功能的输入数据,php,codeigniter,Php,Codeigniter,我正在尝试将用户的输入输入到我的电子邮件正文中。我尝试了$data,但没有成功。不知道我会怎么做。所以基本上,当用户输入姓名和电子邮件并点击submit时,他们会收到一封电子邮件,但若我尝试在邮件中输入$data,结果是空白的。这是我的控制器代码的一部分,电子邮件部分位于 //Insert the callin public function insert_callin() { $data=array('name'=>$this->input->

我正在尝试将用户的输入输入到我的电子邮件正文中。我尝试了$data,但没有成功。不知道我会怎么做。所以基本上,当用户输入姓名和电子邮件并点击submit时,他们会收到一封电子邮件,但若我尝试在邮件中输入$data,结果是空白的。这是我的控制器代码的一部分,电子邮件部分位于

//Insert the callin 
    public function  insert_callin()
    { 


    $data=array('name'=>$this->input->post('name'),
            'email'=>$this->input->post('email'));

        //print_r($data);

            $result=$this->callin_model->insert_callin($data); 
            if($result > 0) 
        {
            $this->session->set_flashdata('msg',"Callin Record Added Successfully");
            $this->load->library('email');

            $this->email->from('your@example.com', 'Your Name');
            $this->email->to('donny.ortiz@nordstrom.com'); 

            $this->email->subject('Email Test');
            $this->email->message($data);

            $this->email->send();


            redirect('callin');

        }
        else
        {

            $this->session->set_flashdata('msg1',"Callin Record Added Failed");
            redirect('callin');


        }

您可以尝试下面的代码

//Insert the callin 
public function  insert_callin()
{ 


    $data=array('name'=>$this->input->post('name'),
        'email'=>$this->input->post('email'));

    $msg_body = "<table>";
    $msg_body .= "<tr>";
    $msg_body .= "<td>Name</td><td>:</td><td>".$data['name']."</td>";
    $msg_body .= "<td>Email</td><td>:</td><td>".$data['email']."</td>";
    $msg_body .= "</tr>";
    $msg_body .= "</table>";

    //print_r($data);

        $result=$this->callin_model->insert_callin($data); 
        if($result > 0) 
    {
        $this->session->set_flashdata('msg',"Callin Record Added Successfully");
        $this->load->library('email');

        $this->email->from('your@example.com', 'Your Name');
        $this->email->to('donny.ortiz@nordstrom.com'); 

        $this->email->subject('Email Test');
        $this->email->message($msg_body);

        $this->email->send();


        redirect('callin');

    }
    else
    {

        $this->session->set_flashdata('msg1',"Callin Record Added Failed");
        redirect('callin');


    }
//插入callin
公共功能插入_callin()
{ 
$data=array('name'=>$this->input->post('name'),
'email'=>this->input->post('email');
$msg_body=“”;
$msg_body.=”;
$msg_body.=“名称:”.$data['Name']”;
$msg_body.=“电子邮件:”.$data['Email']”;
$msg_body.=”;
$msg_body.=”;
//打印(数据);
$result=$this->callin\u model->insert\u callin($data);
如果($result>0)
{
$this->session->set_flashdata('msg','Callin Record Added Successfully');
$this->load->library('email');
$this->email->from($this)your@example.com‘你的名字’;
$this->email->to('donny。ortiz@nordstrom.com'); 
$this->email->subject('email Test');
$this->email->message($msg_body);
$this->email->send();
重定向(“callin”);
}
其他的
{
$this->session->set_flashdata('msg1','Callin Record Added Failed');
重定向(“callin”);
}

$this->email->message
接受字符串而不是数组。

您可以尝试下面的代码

//Insert the callin 
public function  insert_callin()
{ 


    $data=array('name'=>$this->input->post('name'),
        'email'=>$this->input->post('email'));

    $msg_body = "<table>";
    $msg_body .= "<tr>";
    $msg_body .= "<td>Name</td><td>:</td><td>".$data['name']."</td>";
    $msg_body .= "<td>Email</td><td>:</td><td>".$data['email']."</td>";
    $msg_body .= "</tr>";
    $msg_body .= "</table>";

    //print_r($data);

        $result=$this->callin_model->insert_callin($data); 
        if($result > 0) 
    {
        $this->session->set_flashdata('msg',"Callin Record Added Successfully");
        $this->load->library('email');

        $this->email->from('your@example.com', 'Your Name');
        $this->email->to('donny.ortiz@nordstrom.com'); 

        $this->email->subject('Email Test');
        $this->email->message($msg_body);

        $this->email->send();


        redirect('callin');

    }
    else
    {

        $this->session->set_flashdata('msg1',"Callin Record Added Failed");
        redirect('callin');


    }
//插入callin
公共功能插入_callin()
{ 
$data=array('name'=>$this->input->post('name'),
'email'=>this->input->post('email');
$msg_body=“”;
$msg_body.=”;
$msg_body.=“名称:”.$data['Name']”;
$msg_body.=“电子邮件:”.$data['Email']”;
$msg_body.=”;
$msg_body.=”;
//打印(数据);
$result=$this->callin\u model->insert\u callin($data);
如果($result>0)
{
$this->session->set_flashdata('msg','Callin Record Added Successfully');
$this->load->library('email');
$this->email->from($this)your@example.com‘你的名字’;
$this->email->to('donny。ortiz@nordstrom.com'); 
$this->email->subject('email Test');
$this->email->message($msg_body);
$this->email->send();
重定向(“callin”);
}
其他的
{
$this->session->set_flashdata('msg1','Callin Record Added Failed');
重定向(“callin”);
}

$this->email->message
接受字符串而不是数组。

$this->email->message接受字符串,您可以序列化数组,如
$this->email->message(序列化($data));

美元this->email->message接受字符串,您可以序列化数组,如
$this->email->message(序列化($data));

message()接受字符串,所以不能发送数组。使用$this->input->post('name')和$this->input->post('email')消息()简单创建字符串接受字符串,所以不能发送数组。使用$this->input->post('name')和$this->input->post('email')简单创建字符串这是工作,但出来像这样的名字:唐尼电子邮件:test@mail.com@为此,您必须为打开ROOT/application/config/email.php的set设置邮件类型HTML,并添加
$config['mailtype']='html';
这是可行的,但它的名字是这样的:donny Email:test@mail.com@为此,您必须为打开ROOT/application/config/email.php的set设置邮件类型HTML,并添加
$config['mailtype']='HTML';