Help with email attachment filename

#1
[eluser]Unknown[/eluser]
Hi Guys,

I have a program where a user can email someone. This user can be able to save(draft) their message for future sending. My problem is how can I send the email attachments with the correct filename? The correct filename is stored on the database. The filename I used to store their file is generated random string.

$filename = $this->model->the_correct_filename_stored_on_the_database();

$this->email->attach('/path/to/generated_random_string'); //here I want to use the correct filename to be used as its attachment


Anyone pls?
Thanks in advance..

#2
[eluser]pistolPete[/eluser]
Please use [ code ] tags!

I once created an extension of the email ibrary: http://ellislab.com/forums/viewreply/564654/
It allows you to attach a "virtual" file.

In your case you could use:

Code:
$filename = $this->model->the_correct_filename_stored_on_the_database();
$file_contents = file_get_contents('/path/to/generated_random_string');
$this->email->attach($filename, 'attachment', $file_contents );


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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