I want to add attachements to sending e-mails (.[B]txt[B]sql
[code=php]
<?php
$from = “[email protected]”;
$name = “XX”;
$to = “[email protected]”;
$subject = “DB COPY”;
$HTML = “Copy of daily db.”;
function sendHTMLemail($from,$to,$subject,$HTML)
{
$headers = “From: $fromrn”;
$headers .= “MIME-Version: 1.0rn”;
$boundary = uniqid(“HTMLEMAIL”);
$headers .= “Content-Type: multipart/alternative;”.
“boundary = $boundaryrnrn”;
$headers .= “This is a MIME encoded message.rnrn”;
$headers .= “–$boundaryrn”.
“Content-Type: text/plain; charset=utf-8rn”.
“Content-Transfer-Encoding: base64rnrn”;
$headers .= chunk_split(base64_encode(strip_tags($HTML)));
$headers .= “–$boundaryrn”.
“Content-Type: text/html; charset=utf-8rn”.
“Content-Transfer-Encoding: base64rnrn”;
$headers .= chunk_split(base64_encode($HTML));
if (mail($to,$subject,””,$headers)) {
echo(“<p>Message successfully sent!</p>”);
} else {
echo(“<p>Message delivery failed…</p>”);
}
}
sendHTMLemail($from,$to,$subject,$HTML);
?>