Send a .php page as the body in sendmail?
Posted: Fri May 22, 2009 1:43 pm
I have an on-line statement that is available to clients. The page is a complex PHP page that calls date from my DB. I am attempting to send the page as an email to my clients using the code below. Basically, I need to call the page as the 'Body' of the mail. Any idea's on how to put the page there?
The way it sits here, it works like a charm, without the message body off-course but it sends to the recipient without a problem.
Code: Select all
<?php
$to = 'my-client@hismail.com' . ', '; // note the comma
// subject
$subject = "Hello client!";
// message
$message = "I need the .php page here!";
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$headers .= 'From: My Company <accounts@mysite.com>' . "\r\n";
$headers .= 'Cc: my-boss@mysite.com' . "\r\n";
// Mail it
mail($to, $subject, $message, $headers);
?>