How do you send mail via PHP with attachment of HTML file? -> Content of HTML file (code) is within string in DB. Can there be some smart way reely script to get this done? I'd rather not keep file localy, I have to see clearly from DB and send it straightaway as attachment (not incorporated in body).

For those who have a difficult time obtaining the headers right, you could use something similar to PHP Mailer rather than reinventing the wheel.

I love pear.

$text = 'Text version of email';
$html = '<html><body>HTML version of email</body></html>';
$file = './files/';
$crlf = "rn";
$hdrs = array(
              'From'    => '',
              'To'      => '',
              'Subject' => 'Test mime message'
$mime = new Mail_mime($crlf);
$body = $mime->get();
$hdrs = $mime->headers($hdrs);
$mail =& Mail::factory('mail', $params);
$mail->send('', $hdrs, $body); 

You need to have the ability to follow these instructions on delivering email accessories. You'll need to change your code to see a string in the database rather than reading through the items in personal files.