1

I have file html like example.php

Url <a href="<? echo $var ?>"><? echo $var ?></a>

and i want send mail with this file with variable defined in send.php

<?php
$var = "someurl";
$contents = file_get_contents("example.php");
mail("x@x.com", "x", $contents");
?>

And my problem is this that send.php send Url <a href="<? echo $var ?>"><? echo $var ?></a> instead

Url someurl

where someurl is hyperlink.

I tried with fread() but the effect is the same.

Anyone have any ideas how to do it?

kamo
  • 15
  • 5

1 Answers1

2

You can use Php's output buffering and an include:

<?php
$var = "someurl";
ob_start();
include 'example.php';
$contents = ob_get_clean();
mail("x@x.com", "x", $contents);
?>
Progrock
  • 7,373
  • 1
  • 19
  • 25