• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 481
  • Last Modified:

php send email

I have a simple email sending script. In place of a regular message I hope to inlcude a pre formatted php file however I cant seem to get the includes script to gell with the $msg
($msg= includes 'myFile.php') does not work..
Ideas welcome.
N
<?php
	$headers  = 'MIME-Version: 1.0' . "\r\n";
				$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
				$headers .= "Reply-To: no_reply@no_reply.co.nz \r\n";
				$headers .= "From: ceo@nzpia.co.nz\r\n";
				
           // Send
                $subject = "Parachute Certificate with \"A\" Endorsement ";
           		$to      = "neil@beaconhilldesign.co.nz" ;
				$headers .= 'Cc: ' . "\r\n";
		

                                
              // the customers order should go here
			  
 $msg .=' I need to output my myFile.php';

           mail($to, $subject, $msg, $headers);

?>

Open in new window

0
Neil_Bradley
Asked:
Neil_Bradley
  • 4
1 Solution
 
Neil_BradleyWeb UX/UI DeveloperAuthor Commented:
if it helps I have made information I wish to include in my outputted email a functuion called myFile(). However I am still having some trouble getting $msg .= myFile(); to output..
0
 
Jerry MillerCommented:
I believe that it may have to be $msg= <?php include 'myFile.php'; ?>, but the command is include without the 's'.
0
 
Neil_BradleyWeb UX/UI DeveloperAuthor Commented:
That does not work as we are already in php (so don't need to use <?php  ?>
0
 
Neil_BradleyWeb UX/UI DeveloperAuthor Commented:
Figured it out
flush();
ob_start();
myFunction();
$msg .= ob_get_clean();

also works with
flush();
ob_start();
include('myFile');
$msg .= ob_get_clean();
0
 
Neil_BradleyWeb UX/UI DeveloperAuthor Commented:
It was the only correct answer..
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now