Welcome Guest, Not a member yet? Register   Sign In
E-mail sending bug
#1

[eluser]EugeneS[/eluser]
ok here is what i have when submitting email with the Email library CI 1.6.1:

1) in config folder i have email.php with the content:
Code:
<?

$config['protocol'] = 'mail';
$config['mailtype'] = 'html';

2) i have email template:
Code:
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html" charset="utf-8"/>
</head>
<body>

<b>Details:</b><br><br>

Company: &lt;?=$Company;?&gt;<br>
    
Address: &lt;?=$Address;?&gt;<br>
    
Phone: &lt;?=$Phone;?&gt;<br>
    
Email: &lt;?=$Email;?&gt;<br>
    
INN: &lt;?=$INN;?&gt;<br>
    
Name: &lt;?=$Name;?&gt;<br>
    
Goods: &lt;?=$Goods;?&gt;<br>
    
Details: &lt;?=$Details;?&gt;<br>
    
Qty: &lt;?=$Qty;?&gt;<br>
    
Delivery: &lt;?=$Delivery;?&gt;<br>

&lt;/body&gt;
&lt;/html&gt;

3) in controller i use next code to make all of this up and running:
Code:
$this->load->library('email');
$order_details = array(
            'Name'        => $process['Name'],
            'Phone'        => $process['Phone'],
            'Email'        => $process['Email'],
            'Company'    => $process['Company'],
            'Address'    => $process['Address'],
            'INN'        => $process['INN'],
            'Goods'        => $process['Goods'],
            'Details'    => $process['Details'],
            'Qty'        => $process['Qty'],
            'Delivery'    => $process['Delivery'],
);

$this->load->view('email/new_order', $order_details);
$email_body = $this->output->get_output();

$this->email->from($process['Email'], $process['Name']);

$send_to = array(
        'email@to_send.to',
);

$this->email->to($send_to);

$this->email->subject($this->lang->line('email_new_order_subject'));
$this->email->message($email_body);

$this->email->send();

4) FINALLY i receive email with a lot of unnecessary symbols, result of multipart ?
this problem still exists sinse CI 1.5.4 or even earlier

Code:
Details:

Company: company name
=00 Address: address
=00 Phone: 12213234
=00 Email: [email protected]
=00 INN: 345345
=00 Name: Eugene S.
=00 Goods: something goes here
=00 Details: white
=00 Qty: 234
=00 Delivery: by mail
--B_ALT_48081114b4585--

unnecessary data:
=00
--B_ALT_48081114b4585--
#2

[eluser]EugeneS[/eluser]
because of this bug i have to use Email class version from one of previous version where ive commented lines to avoid this injections (in most cases i dont need attachements)

this commenting help to solve the problem Smile)))
without attachements but with correct html email Smile

hope in next CI version this problem will be solved.

Code:
case 'html' :
                /*                
                $hdr .= "Content-Type: multipart/alternative; boundary=\"" . $this->_alt_boundary . "\"" . $this->newline;
                $hdr .= $this->_get_mime_message() . $this->newline . $this->newline;
                $hdr .= "--" . $this->_alt_boundary . $this->newline;
                
                $hdr .= "Content-Type: text/plain; charset=" . $this->charset . $this->newline;
                $hdr .= "Content-Transfer-Encoding: " . $this->_get_encoding() . $this->newline . $this->newline;
                $hdr .= $this->_get_alt_message() . $this->newline . $this->newline . "--" . $this->_alt_boundary . $this->newline;
                    */
                $hdr .= "Content-Type: text/html; charset=" . $this->charset . $this->newline;
                $hdr .= "Content-Transfer-Encoding: quoted-printable";
                
                $this->_body = $this->_prep_quoted_printable($this->_body);
                
                if ($this->_get_protocol() == 'mail')
                {
                    $this->_header_str .= $hdr;
                    //$this->_finalbody = $this->_body . $this->newline . $this->newline . "--" . $this->_alt_boundary . "--";
                    $this->_finalbody = $this->_body . $this->newline . $this->newline;
                    
                    return;
                }
                
                $hdr .= $this->newline . $this->newline;
                //$hdr .= $this->_body . $this->newline . $this->newline . "--" . $this->_alt_boundary . "--";
                $hdr .= $this->_body . $this->newline . $this->newline;

                $this->_finalbody = $hdr;
                return;
        
            break;




Theme © iAndrew 2016 - Forum software by © MyBB