// Open the email html file and read in the contents. $file = "email.html"; $handle = fopen($file, "r"); $file_contents = fread($handle, filesize($file)); // Also strip the header and footer text. $header = "Include Digital sent you this email. To ensure you don't miss future email updates, please add email@example.com to your email address book or safe list. If this email does not display properly, please click here to view it in your web browser."; $footer = "
To subscribe to the Include Digital digest, click here and enter your details."; // Replace any personalised content, and also the header and footer with the unsubscribe information. $file_contents = str_replace(array($header, $footer, "?name=%%FIRSTNAME%%&email=%%EMAIL%%", "%%FIRSTNAME:there%%"), array("", $subscribeInfo, "", "there"), $file_contents); // Output the html to the page. echo $file_contents; ?>