Welcome Guest, Not a member yet? Register   Sign In
Help with email attachment filename

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..

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:

$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 );

Theme © iAndrew 2016 - Forum software by © MyBB