在电子邮件中显示图像

时间:2017-01-17 05:20:43

标签: php

以下是我的功能正常工作,有一个问题,它不显示电子邮件中的图像为什么? 如果我发送带有附件的图像,那么它不会显示在消息内

提供帮助

public function send_email() {
    //getting form data 
    $username =$this->input->post('username');
    $from     = $this->input->post('from');
    $to       = $this->input->post('to');
    $subject  = $this->input->post('subject');
    $message  = '<html><head></head><body><img src="https://www.freedigitalphotos.net/blog/wp-content/uploads/2014/01/facebook-image-compression-570x200.jpg" width="200px" height="200px;" />"'.$this->input->post('message').'" </body>';
    //email config 
    $config['protocol'] = 'smtp';
    $config['smtp_host'] = 'ssl://smtp.googlemail.com';
    $config['smtp_port'] = '465';
    $config['smtp_user'] = 'XXXXX@gmail.com';
    $config['smtp_pass'] = 'XXXXX';
    $config['mailtype'] = 'html';
    $config['charset'] = 'iso-8859-1';
    $config['wordwrap'] = TRUE;
    $config['newline'] = "\r\n";
    $this->load->library('email',$config);  
    $this->email->initialize($config);   
    $this->email->from($from, $username);
    $this->email->to($to);
    $this->email->subject($subject);
    $this->email->message($message);
    if ($this->email->send()) {
        $this->session->set_flashdata('msg','<div class="alert alert-success text-center">Your mail has been sent successfully!</div>');
        echo"mail send successfully";
    } else { 
        $this->session->set_flashdata('msg','<div class="alert alert-danger text-center">There is error in sending mail! Please try again later</div>');
        $debug=$this->email->print_debugger();  
        //echo $debug;die;
    } 
}

0 个答案:

没有答案
相关问题