• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bug width Email attach

#1
Exclamation 
I have a simple email function

PHP Code:
function sendLetter($data) {



 $CI =& get_instance();


 $CI->load->library('email');


 $config = array (


 
       'protocol'  => 'smtp',


 
       'smtp_host' => SMTP_HOST,


 
       'smtp_port' => SMTP_PORT,


 
 'smtp_user' => SMTP_USER


 
       'smtp_pass' => SMTP_PASS,


 
       'mailtype'  => 'html',


 
       'charset'   => 'UTF-8',


 
 'newline'   => '\r\n'    


    
);

 if(isset($data['attach']))
  $CI->email->attach($data['attach']); 
 
$CI
->email->initialize($config); 
 $CI
->email->from('[email protected]''Peter');
 $CI->email->message($CI->twig->render('mail_templates/body'$data));
 $CI->email->to($data['to']);
 $CI->email->subject($data['title']);
 return $CI->email->send() ? 'ok' 'error';
}

Then I call function two times

sendLetter 
(

    array (
    'title' => 'First Letter',
    'to' => '[email protected]',
    'file' => 'mail_templates/invoice.html',
    'attach' => $file,
   )
  ); 
PHP Code:
    array 
PHP Code:
    'title' => Second Letter', 
PHP Code:
    'to' => '[email protected]'
PHP Code:
    'file' => 'mail_templates/invoice.html',
    'attach' => $file
PHP Code:
   
PHP Code:
  ); 
PHP Code:
     
PHP Code:
   
PHP Code:
sendLetter (

    array (
    'title' => 'First Letter',
    'to' => '[email protected]',
    'file' => 'mail_templates/invoice.html',
    'attach' => $file,
   )
  ); 

The problem is second receiver has two (double attaches ) in his letter
Reply


Messages In This Thread
Bug width Email attach - by motoroller - 05-15-2015, 03:44 AM
RE: Bug width Email attach - by Wouter60 - 05-15-2015, 06:19 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.