• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
send 3 email each with attachment

#1
Hi , sorry for english , i create a function :
PHP Code:
    public function send_email($email$subject,$messaggio_formattato,$attachment=null)
    {
        
        $this
->load->library('email');
        $this->config->load('email_config');


        $this->email->set_mailtype("html");

        $this->email->from($this->config->item('email_sito'), $this->config->item('email_sito_name'));
        $this->email->to($email);


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

        $message '
        <html>
        <head>
            <title></title>
        </head>
        <body>'
.
        $messaggio_formattato
        
.

        '
        </body>
        </html>'
;

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

        //se c'è l'allegato lo aggiungo
        if ($attachment) {
  
          $this
->email->attach($attachment);
          
        
}

        return $this->email->send();

    

in a controller function i create a pdf with fpdf and save a temporany file :

$pdf_filename = "order_".$res_order.".pdf";

$pdf->Output($pdf_filename, "F");

Than i send 3 email .

$this->send_email($this->config->item('email_admin'), $subject,$messaggio_formattato,$pdf_filename);


$this->send_email($agente->email, lang('ordini_ordini_inviato'), lang('ordini_ordini_inviato_messaggio') ,$pdf_filename);


$this->send_email($user->email, lang('ordini_ordini_inviato'), lang('ordini_ordini_inviato_messaggio_user') ,$pdf_filename);


In first email i have an attachment , in second two attachment in third 3 attachment.....Why ?
Reply


Messages In This Thread
send 3 email each with attachment - by pippuccio76 - 11-06-2019, 02:15 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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