Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.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
Html Codeigniter电子邮件类不工作_Html_Codeigniter_Email - Fatal编程技术网

Html Codeigniter电子邮件类不工作

Html Codeigniter电子邮件类不工作,html,codeigniter,email,Html,Codeigniter,Email,我正在尝试Codeigniter电子邮件类,但它不工作,或者可能是,我在配置或其他方面出错。请把它修好,告诉我该怎么办。我对codeigniter电子邮件类有问题 这是将表单数据发送到控制器后的屏幕截图 视图: 试试这个: $config = Array( 'protocol' => 'smtp', 'smtp_host' => 'test1@gmail.com', 'smtp_por

我正在尝试Codeigniter电子邮件类,但它不工作,或者可能是,我在配置或其他方面出错。请把它修好,告诉我该怎么办。我对codeigniter电子邮件类有问题

这是将表单数据发送到控制器后的屏幕截图

视图:

试试这个:

$config = Array(
                'protocol' =>  'smtp',
                'smtp_host' => 'test1@gmail.com',
                'smtp_port' =>  2525,
                'smtp_user' => 'gmailusername',
                'smtp_pass' => 'password',
                'mailtype'  => 'html', 
                'charset'   => 'iso-8859-1'
            );
    $config['wordwrap'] = TRUE;
    $config['mailtype'] = 'html';

    $THIS->email->initialize($config);
    $THIS->email->set_newline("\r\n");
    $body = str_replace(array('{LOGO_IMAGE}'),array($logo_image),$body);

    $body.= email_footer();
    $body = '<div style="width:700px;float:left;">'.$body.'</div>';
    if (!empty($from))
    {
        $from_name = !empty($from_name) ? $from_name : SITE_NAME;
        $from = !empty($from) ? $from : 'noreply@test.com';        
        $THIS->email->from($from, $from_name);
    }
    else
    {
        $THIS->email->from('noreply@test.com', $from_name);
    }
    if (!empty($to))
    {
        $THIS->email->to($to);
    }
    if (!empty($cc))
    {
        $THIS->email->cc($cc);
    }
    if (!empty($bcc))
    {
        $THIS->email->cc($bcc);
    }
    $THIS->email->subject($subject);
    $THIS->email->message($body);

    if (!empty($attachment))
    {
        if (is_array($attachment))
        {
            foreach ($attachment as $val) 
            {
                $THIS->email->attach($val);
            }
        }
        else
        {
            $THIS->email->attach($val);
        }
    }

    if ($THIS->email->send())
    {
        return TRUE;
    }
    else{
        echo $THIS->email->print_debugger();
        exit;
    }
$config=Array(
'协议'=>'smtp',
'smtp_主机'=>'test1@gmail.com',
“smtp_端口”=>2525,
“smtp_用户”=>“Gmail用户名”,
'smtp_pass'=>'密码',
“邮件类型”=>“html”,
“字符集”=>“iso-8859-1”
);
$config['wordwrap']=TRUE;
$config['mailtype']='html';
$THIS->email->initialize($config);
$THIS->email->set_newline(“\r\n”);
$body=str_replace(数组({LOGO_IMAGE}'),数组($LOGO_IMAGE),$body;
$body.=电子邮件页脚();
$body=''.$body';
如果(!空($from))
{
$from\u name=!empty($from\u name)?$from\u name:SITE\u name;
$from=!空($from)?$from:'noreply@test.com';        
$THIS->email->from($from,$from_name);
}
其他的
{
$THIS->email->from($THIS)noreply@test.com“,$from_name);
}
如果(!空($to))
{
$THIS->email->to$to;
}
如果(!空($cc))
{
$THIS->email->cc($cc);
}
如果(!空($bcc))
{
$THIS->email->cc($bcc);
}
$THIS->email->subject($subject);
$THIS->email->message($body);
如果(!空($attachment))
{
if(is_数组($attachment))
{
foreach($附件为$val)
{
$THIS->email->attach($val);
}
}
其他的
{
$THIS->email->attach($val);
}
}
如果($THIS->email->send())
{
返回TRUE;
}
否则{
echo$THIS->email->print_debugger();
出口
}
如果有效,请将其标记为已接受

public function feedBack()
{
    $this->load->library('email');

    $config['protocol'] = 'smtp';

    $config['smtp_host'] = 'host8.registrar-servers.com';

    $config['smtp_port'] = '465';

    $config['smtp_timeout'] = '30';

    $config['smtp_user'] = 'info@dewbn.com';

    $config['smtp_pass'] = 'myPass';

    $config['charset'] = 'utf-8';

    $config['crlf'] = '\r\n';      //should be "\r\n"
    $config['newline'] = '\r\n';   //should be "\r\n"

    $config['mailtype'] = 'html'; // or html

    $config['validation'] = TRUE; // bool whether to validate email or not

    $this->email->initialize($config);



    $senderName = $this->input->post('senderName');
    $senderPhone = $this->input->post('senderPhone');
    $senderEmail = $this->input->post('senderEmail');
    $senderSubject = $this->input->post('senderSubject');
    $senderMsg = $this->input->post('senderMsg');

    $this->email->from($senderEmail, $senderName);
    $this->email->to('bablukpik@gmail.com');


    $this->email->subject($senderSubject);

    $this->email->message($senderMsg);

    if($this->email->send()) {
        echo "Success!";
        //return true;
    } else {
        echo "Failure!";
        //return false;
    }

}
$config = Array(
                'protocol' =>  'smtp',
                'smtp_host' => 'test1@gmail.com',
                'smtp_port' =>  2525,
                'smtp_user' => 'gmailusername',
                'smtp_pass' => 'password',
                'mailtype'  => 'html', 
                'charset'   => 'iso-8859-1'
            );
    $config['wordwrap'] = TRUE;
    $config['mailtype'] = 'html';

    $THIS->email->initialize($config);
    $THIS->email->set_newline("\r\n");
    $body = str_replace(array('{LOGO_IMAGE}'),array($logo_image),$body);

    $body.= email_footer();
    $body = '<div style="width:700px;float:left;">'.$body.'</div>';
    if (!empty($from))
    {
        $from_name = !empty($from_name) ? $from_name : SITE_NAME;
        $from = !empty($from) ? $from : 'noreply@test.com';        
        $THIS->email->from($from, $from_name);
    }
    else
    {
        $THIS->email->from('noreply@test.com', $from_name);
    }
    if (!empty($to))
    {
        $THIS->email->to($to);
    }
    if (!empty($cc))
    {
        $THIS->email->cc($cc);
    }
    if (!empty($bcc))
    {
        $THIS->email->cc($bcc);
    }
    $THIS->email->subject($subject);
    $THIS->email->message($body);

    if (!empty($attachment))
    {
        if (is_array($attachment))
        {
            foreach ($attachment as $val) 
            {
                $THIS->email->attach($val);
            }
        }
        else
        {
            $THIS->email->attach($val);
        }
    }

    if ($THIS->email->send())
    {
        return TRUE;
    }
    else{
        echo $THIS->email->print_debugger();
        exit;
    }