Welcome Guest, Not a member yet? Register   Sign In
Email attachments unable to locate files
#1

[eluser]Ngulo[/eluser]
Hi guys,

i'm trying sending attachments files in email :

all is working but and email arrives but attachments shows this error:
Code:
Unable to locate the following email attachment: http://www.asd.com/files/file.pdf

if i go to file url (http://www.asd.com/files/file.pdf ) by browser i can see that file!! Sad

anyone can help me?

my email script is simple:

Code:
if($_FILES['bill_file']['tmp_name'] and $_FILES['bill_file']['name'])
            {
                     if($this->input->post('email_for_bill',true)){
                     $billTemp = htmlentities($_FILES['bill_file']['tmp_name']);
                     $bill = htmlentities($_FILES['bill_file']['name']);
                  //  if(move_uploaded_file($billTemp,'uploads/orders/bills/'.$bill))
                    //{

                      $this->load->library('email');
                       $config['charset'] = 'iso-8859-1';
                       $config['mailtype'] = 'html';

                      $this->email->initialize($config);
                      
                      $this->email->from($this->config->config['email_from'],$this->config->config['email_sender_sitename']);
                      $this->email->to($this->input->post('email_for_bill',true));
                      $this->email->subject("my order n ".$id."(Order Bill)");
                      $this->email->message('asdasd');
                      $this->email->attach(base_url().'uploads/orders/bills/'.$bill);

                      $this->email->send();

                      unset($data);
                      $data = array('bill_sent'=>'1');
                      $this->order_bills->update($id,$data);
                    }
                   //  }
                    
            }//end upload + email attachment send

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

so just to explain my script, first of all i upload and move file into main folder, then i create email , take created file and attach that to email and in the end i send email...

my folders are all 775 Sad

really don't know why anytime the file is created but not attached Sad

thanks to anyone can help me guys Wink
#2

[eluser]Atharva[/eluser]
That's coz you are using absolute path. You need to use relative path. See following statement from the guide
Quote:Note: Use a file path, not a URL.
Code:
$this->email->attach('/path/to/photo1.jpg');
#3

[eluser]Ngulo[/eluser]
thanks man!!! solved Smile

really thanks




Theme © iAndrew 2016 - Forum software by © MyBB