Welcome Guest, Not a member yet? Register   Sign In
html email still sending as text/plain
#9

[eluser]doubleplusgood[/eluser]
Hey guys,

So here is the code from my send function;

Code:
function send()
    {        
        // field name, error message, validation rules
        $this->form_validation->set_rules('name', 'Name', 'trim|required|xss_clean');
        $this->form_validation->set_rules('email', 'Email Address', 'trim|required|valid_email|xss_clean');
        $this->form_validation->set_rules('telephone', 'Telephone Number', 'trim|xss_clean');
        $this->form_validation->set_rules('enquiry', 'Enquiry', 'trim|required|xss_clean');*/
        
        
        // validation has passed. Now send the email
        $name = $this->input->post('name', TRUE);
        $email = $this->input->post('email', TRUE);
        $telephone = $this->input->post('telephone', TRUE);
        $bike = $this->input->post('bike', TRUE);
        $enquiremethod = $this->input->post('enquiremethod', TRUE);
        $description = $this->input->post('description', TRUE);
        $our_price = $this->input->post('our_price', TRUE);
        $list_price = $this->input->post('list_price', TRUE);
        $url_slug = $this->input->post('url_slug', TRUE);
        $url = strtolower($url_slug);
        $formattedprice = substr($our_price,0,-3);
        $formattedlistprice = substr($list_price,0,-3);
        $saving = $formattedlistprice - $formattedprice;
        
        $data=array(
        'name'=>$name,
        'email'=>$email,
        'telephone'=>$telephone,
        'bike'=>$bike,
        'enquiremethod'=>$enquiremethod,
        'our_price'=>$our_price,
        'list_price'=>$list_price,
        'url_slug'=>$url_slug,
        'created'=>date('Y-m-d h:i:s'),
        'updated'=>date('Y-m-d h:i:s')
        );
        $this->load->model('quoteenquiremodel');
        $this->quoteenquiremodel->insert($data);
        
        $this->load->library('email');
        $config['mailtype'] = 'html';
        $config['charset'] = 'utf-8';
        $config['newline'] = "\r\n";

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

        $this->email->from($this->config->item('website_from_email'), $this->config->item('website_from_email_name'));
        $this->email->reply_to($email, $name);
        $this->email->bcc($this->config->item('email_to'));
        $this->email->to($email);
        
        if($enquiremethod == 'quote') {
            $this->email->subject('QUOTE REQUEST');    
            $message = "Hi $name,<br />
<br />
The current list price on this bike is £$formattedlistprice OTR.<br />
<br />
We are currently able to offer this bike at an astonishing: <strong>£$formattedprice OTR</strong>.<br />
<br />
An amazing saving of: <strong>£$saving</strong>.<br />
<br />
This price is only available whilst current stocks last.<br />
<br />
$description<br />
Kind Regards<br />
Sales Team";
        //} elseif($enquirymethod == 'enquiry') {
        } else {
            $this->email->subject('ENQUIRY');    
            $message = "Details of your enquiry:-<br />
<br />
Bike: $bike<br />
<br />
Bike description: $description<br />
<br />
User Name: $name<br />
User Email: $email<br />
User Telephone: $telephone<br />
<br />
Kind Regards;
        }
        
            
        $this->email->message($message);
        
        if($this->email->send())
        {
            if($enquiremethod == 'quote') {
                $formattedprice = substr($our_price,0,-3);
                $phpsubject = "Bike Quote";
                $phpemailto = "$telephone";
                $smsmessage = "Our best price on the $bike is £$formattedprice OTR.";
                
                mail($phpemailto,$phpsubject,$smsmessage);
            }
            return true;
        }

        else
        {
            show_error($this->email->print_debugger());
        }

    }

}


Messages In This Thread
html email still sending as text/plain - by El Forum - 09-30-2010, 05:36 AM
html email still sending as text/plain - by El Forum - 09-30-2010, 05:50 AM
html email still sending as text/plain - by El Forum - 09-30-2010, 05:51 AM
html email still sending as text/plain - by El Forum - 09-30-2010, 05:51 AM
html email still sending as text/plain - by El Forum - 09-30-2010, 05:59 AM
html email still sending as text/plain - by El Forum - 09-30-2010, 11:00 AM
html email still sending as text/plain - by El Forum - 09-30-2010, 11:47 AM
html email still sending as text/plain - by El Forum - 09-30-2010, 03:14 PM
html email still sending as text/plain - by El Forum - 10-01-2010, 03:54 AM
html email still sending as text/plain - by El Forum - 10-01-2010, 04:14 AM
html email still sending as text/plain - by El Forum - 10-01-2010, 04:27 AM
html email still sending as text/plain - by El Forum - 10-01-2010, 04:30 AM
html email still sending as text/plain - by El Forum - 10-01-2010, 04:48 AM
html email still sending as text/plain - by El Forum - 10-01-2010, 05:13 AM
html email still sending as text/plain - by El Forum - 10-01-2010, 05:41 AM
html email still sending as text/plain - by El Forum - 10-01-2010, 06:02 AM



Theme © iAndrew 2016 - Forum software by © MyBB