...

View Full Version : PHP Email Attachment



tsidell
12-04-2008, 05:37 PM
<?php
$to = "James.Naismeth@nba.com";
$subject = "Some Ideas For Basketball";
$url = 'http://www.nba.com/thisweek/output.php';
$page = file_get_contents($url);
$body = $page;

if (mail($to, $subject, $body)) {
echo("<p><center>Message successfully sent!</center></p>");
} else {
echo("<p><center>Message delivery failed...</center></p>");
}
?>

Say I have this code above, it takes the source code of output.php and send its to me in an email. How do I create a .txt attachment of this source code and have that emailed to me instead.

Thanks.

_Aerospace_Eng_
12-04-2008, 05:44 PM
Look into a php mail class like PHPMailer. It makes it easy to send attachments. You'll need to create a temp file on your server and attach that.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum