Jump to content


Photo

insert contenst of php page into body of email


  • Please log in to reply
3 replies to this topic

#1 NicksterFL

NicksterFL
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 21 September 2006 - 08:23 PM

is there anyway i can insert the contents of a php page into the body of an email?

can someone post a simple example. Need to basically scrape a page and insert the page contents into the body section of an email that's being sent via php.


#2 AdRock

AdRock
  • Members
  • PipPipPip
  • Advanced Member
  • 911 posts

Posted 21 September 2006 - 10:57 PM

what do you want to put in the email?
If your topic has been solved, please mark the topic as SOLVED.

This helps others from identifying which topics need help still

#3 warewolfe

warewolfe
  • Members
  • PipPipPip
  • Advanced Member
  • 57 posts
  • LocationOtago, NZ

Posted 21 September 2006 - 11:03 PM

Hi, how are you planning in getting the page in the first place? Is it a page you are getting from the net or one you are generating in the first place? The second is a lot easier than the first.

#4 Skatecrazy1

Skatecrazy1
  • Members
  • PipPipPip
  • Advanced Member
  • 126 posts
  • LocationSouthern California

Posted 22 September 2006 - 01:41 AM

<?php
//name your file either through root path or whatever
$filename = "your_php_file_name_here.php";
//open the file
$file = fopen($file, "r"); 
//get the php file's size
$filesize = filesize($filename);
//read the file and put contents into a variable
$code = fread($file, $filesize);
fclose($file);
//then you can take your code variable and put it into your mail form
?>

<form method="post" action="mailer_script_filename.php">
Message:<textarea rows="20" cols="25" name="newmsg">
<?php echo $code; ?>
</textarea>
<br />
<input type="submit" value="send email">
</form>


i'm not sure, but if your mailer script gets parse errors then just do

$code = addslashes($code);

but it probably won't, so disregard that last little snippet unless you get errors
fuck it or fight it




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users