Attach binary file via Email class right from MySQL database |
[eluser]andyy[/eluser]
I'm looking to attach a binary file (.pdf) to an e-mail right from a MySQL database using the Email class. I'm trying to avoid writing the MySQL binary store to a flat file in a specified directory and then attaching it (but I may have no choice). Code: $this->load->library('email'); Anyone want to provide some insight into this? Thanks.
[eluser]adityamenon[/eluser]
Are you storing the pdf binary data directly inside the MySQL db? Is this a necessity? Most people simply store the pdf inside a folder on the server, and only remember the file name with a database. This saves DB disk space...which is more precious than file-system disk space... and will make your MySQL queries faster since the DB engine doesn't have to wade through tons of crazy pdf characters every time it needs to do a select. If it is a necessity, however, then yes, your line of thought is correct. I think there's no other way but to write the pdf data from your DB into a temp file and attach that file. |
Welcome Guest, Not a member yet? Register Sign In |