• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 486
  • 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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