Adrian Bruce wrote:


I have pdf's stored as a blob in a MySQL database, how can i set a script (PHP obviously!) to email these blobs as pdf files. The only way

No, not "Obviously", PHP is not well suited for many tasks (or has a high cost to get the suit tailored) :)

If you branch out you'll find a whole world of alternatives that are easier to code and maintain server wise. All without the onslaught of PHP security vulnerabilities and performance bloats.

i can think of at the moment is to write them to disk and then attach them to the mail before sending it. This doesn't seem that efficient but perhaps it is the only way??

Nope, its fine to attach it from a variable, in fact an example of how to do just that can be found at

under the "EXAMPLE" header.

you'd simply:

my($pdf_guts) = $dbh->selectrow_array(q{SELECT pdf_guts FROM pdf_store WHERE id = '123'}); #

PHP's mail() is a lame lame function with limited ability and even higher hackability, don't use it.

HTH :)

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to