Welcome Guest, Not a member yet? Register   Sign In
I have created the onfly pdf but its not sending mail to desired email address
#1

[eluser]Unknown[/eluser]
Hi I am new at CI I have faced a problem after generating a on fly pdf and send it to my user. It creates on fly pdf but does not attach at email. this this is my model function where i called the pdf class
Code:
function counter_offer_submit(){
                $lId =$_SESSION['lId'];
                $contract_letter=$this->pdf();
                $filename   = md5(time() * rand(100, 1000)) .'.pdf';
                
                 //$contract_letter;
                  $data_part1 = array(

                                              'contract_build'=>'1',
                                             //'contract_letter'=>$contract_letter
                                            );
                                            $where="id=$lId";
                                             $query=$this->db->update_string('loan',$data_part1,$where);
                                             $this->db->query($query);
                     $query = $this->db->query("select borrower_id,lender_id from digi_loan where id=$lId");
                     foreach($query->result() as $field){
                                             $borrower_id=$field->borrower_id;
                                              $lender_id=$field->lender_id;
                                     }
                                    
                     $query2 = $this->db->query("select email from digi_users where id=$borrower_id or id=$lender_id ");
                    
                     foreach($query2->result() as $field){
                                             $des=$field->email.',';
                                     }            
                    
                     $this->email->from('[email protected]', 'Lenders Utopia');
                    $this->email->to($des);
                    $this->email->cc('[email protected]');
                    $this->email->bcc('[email protected]');

                    $this->email->subject('Contract Confirmation Letter for Loan Applied');
                    $this->email->message($filenam);    

                    $this->email->send();

                    echo $this->email->print_debugger();exit;
             }

and the pdf function is
Code:
function pdf()
            {    
                
                
                $this->load->library('cezpdf');
                $this->load->helper('pdf');
                $this->cezpdf->ezText('LOAN AGREEMENT AND PROMISSORY NOTE OF '.$offers_loan_name, 12, array('justification' => 'center'));
                $this->cezpdf->ezSetDy(-10);
        
                $content = 'THIS LOAN AGREEMENT AND PROMISSORY NOTE OF Example PDF
        
        ';

    $this->cezpdf->ezText($content, 10);
        
                
                
                prep_pdf(); // creates the footer for the document we are creating.
$this->cezpdf->ezStream();

Please Help me!!
#2

[eluser]danmontgomery[/eluser]
I see all kinds of problems here.

First, you never attach anything, so I'm not sure how you expect the file to appear in the email.

Your pdf function doesn't return anything... I'm not familiar with cezpdf, but in order to assign a value to $contract_letter, the pdf() function needs to return something. You also generate the filename after you generate the pdf, (and don't reference either ever again). It should work like this:

1. Generate PDF
2. Save PDF to a path
3. Attach PDf to email (by using the path generated in the previous step)
4. Send Email

http://ellislab.com/codeigniter/user-gui...email.html




Theme © iAndrew 2016 - Forum software by © MyBB