0

Dear All

I have 2 Pages
smtpAuth.php
contents.php

When I use this code

$body             = file_get_contents('contents.php');
      $body             = eregi_replace("[\]",'',$body);

It cannot show PHP variables values in Send email.
Content.php file attached as contentsphpfile

Whole HTML working fine but PHP DataBase values are not showing in Email.

Attachments
<?php include("config.php");
$a	= '5678'; ?>
<body style="margin: 10px;">
<div style="width: 640px; font-family: Arial, Helvetica, sans-serif; font-size: 11px;">
<div align="center"><img src="images/phpmailer.gif" style="height: 90px; width: 340px"></div><br>
<br>
&nbsp;<strong>Outstanding Cheques Finance</strong><br>
<br>
<table width="100%" border="1" cellspacing="1" cellpadding="1">
  <tr>
    <td width="42%"><strong>Total Days</strong></td>
    <td width="58%"><strong>No. of Payments</strong></td>

  </tr>
  <tr>
    <td><strong>15-21</strong></td>
    <td><?php
echo $a;
?></td>

  </tr>
  <tr>
    <td><strong>21-30</strong></td>
    <td>&nbsp;</td>

  </tr>
  <tr>
    <td><strong>30+</strong></td>
    <td>&nbsp;</td>

  </tr>
</table>


<br />
Engineering Database:<br />
Generated Automatically by Engineering Databse<br />
Please, DO NOT Reply to this System Generated Email.<br />
</div>
</body>
2
Contributors
8
Replies
9
Views
6 Years
Discussion Span
Last Post by urtrivedi
0

I am getting everything of HTML tags, but not getting echo Var a; value in my email or even echo this code

$body             = file_get_contents('contents.php');

When I open the contents.php it shows value of a in browser.

0

Try with php_curl
You must enable php_curl on your server.

then write following function in your smtpauth.php

<?php
function my_curl($url,$rethdr=0)
{
	$ch = curl_init();
	curl_setopt ($ch, CURLOPT_URL, $url);
	curl_setopt ($ch, CURLOPT_HEADER, $rethdr);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	$res=curl_exec($ch);	
	return $res;
}
?>

$body=my_curl('http://localhost/yourfolder/contents.php',1);

I hope this will work

0

Try with php_curl
You must enable php_curl on your server.

then write following function in your smtpauth.php

<?php
function my_curl($url,$rethdr=0)
{
	$ch = curl_init();
	curl_setopt ($ch, CURLOPT_URL, $url);
	curl_setopt ($ch, CURLOPT_HEADER, $rethdr);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	$res=curl_exec($ch);	
	return $res;
}
?>

$body=my_curl('http://localhost/yourfolder/contents.php',1);

I hope this will work

curl is difficult but my problem is simple, if i use html and php code on smtpauth.php its work fine, but if i get it using get content why its not working
0

Ok, but if I put my whole contents.php code in the smtpauth.php then it will work fine. but only one problem , its not including image, all other code is working fine
here is code

$body			= "<html><body style='margin: 10px;'>
<div style='width: 640px; font-family: Arial, Helvetica, sans-serif; font-size: 11px;'>
<div align='center'><img src='images/phpmailer.gif' style='height: 90px; width: 340px'></div><br>
<table  style='border-color: #666;' cellpadding='10'>
  	<tr>
    <td width='42%' style='background: #eee;'><strong>Total Days</strong></td>
    <td width='58%' style='background: #eee;'><strong>No. of Payments</strong></td>
	</tr>
	
	 	<tr>
    <td width='42%' style='background: #eee;'>15-21</td>
    <td width='58%'>$num_rows</td>
	</tr>
	
		 	<tr>
    <td width='42%' style='background: #eee;'>21-30</td>
    <td width='58%'>$num_rows</td>
	</tr>
	
		 	<tr>
    <td width='42%' style='background: #eee;'>30+</td>
    <td width='58%'>$num_rows</td>
	</tr>

</table>
<br />
Engineering Database:<br />
Generated Automatically by Engineering Databse<br />
Please, DO NOT Reply to this System Generated Email.<br /></div></body></html>";
0

<?php
<img src='<?php echo "http://".$_SERVER["HTTP_HOST"]."/yourfolder/images/phpmailer.gif" ?>' style='height: 90px; width: 340px'>

?>

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.