Hey
I have created a script what sends an email with a text-based attachment (or: html based attachment). This script works on a debian system without da, but with da it won't work. It sends an email, with attachment, but the attachment is empty!!
Help?
I have created a script what sends an email with a text-based attachment (or: html based attachment). This script works on a debian system without da, but with da it won't work. It sends an email, with attachment, but the attachment is empty!!
Help?
Code:
function mailbackup($dbase, $tekst, $mail)
{
//specify MIME version 1.0
$headers = "MIME-Version: 1.0\n";
//add From: header
//$headers .= "From: Support <[email protected]>\n";
//unique boundary
$boundary = uniqid("HTMLDEMO");
$headers .= "Content-Type: multipart/mixed" .
"; boundary = $boundary\n\n";
//tell e-mail client this e-mail contains//alternate versions
$headers .= "Content-Type: multipart/alternative" .
"; boundary = $boundary\n\n";
//message to people with clients who don't understand MIME
$headers .= "This is a MIME encoded message.\n\n";
//plain text version of message
$headers .= "--$boundary\n" .
"Content-Type: text/plain; charset=ISO-8859-1\n" .
"Content-Transfer-Encoding: base64\n\n";
$dag = date('Y-m-d H:i');
$message = "Backup $dag van database $dbase";
$headers .= chunk_split(base64_encode("$message"));
$headers .= "--$boundary\n" ."Content-Type: text/plain;".
"name=\"$dbase_$dag.sql\"\n".
"Content-Transfer-Encoding: base64\n".
"Content-Disposition: attachment;\n".
"";
$headers .= chunk_split(base64_encode("$tekst"));
//send message
mail("$mail", "Backup $dbase $dag", "", $headers);
}