<?php
// Path to the file
$fileatt = "" ;
// File Type
$fileatt_type = "application/octet-stream" ;
// Filename that will be used for the file as the attachment
$fileatt_name = "" ;
// Who the email is from
$email_from = "" ;
// The Subject of the email
$email_subject = "" ;
// Message that the email has in it
$email_txt = "" ;
// Who the email is too
$email_to = "" ;
$headers = "From: " . $email_from ;
// check if your file is exist in your folder or not
if ( file_exists ( $fileatt )) {
echo "The file $fileatt exists" ;
}else{
echo "The file $fileatt does not exist" ;
}
$file = fopen ( $fileatt , 'rb' );
$data = fread ( $file , filesize ( $fileatt ));
fclose ( $file );
$semi_rand = md5 ( time ());
$mime_boundary = "==Multipart_Boundary_x { $semi_rand } x" ;
$headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\" { $mime_boundary } \"" ;
$email_message .= "This is a multi-part message in MIME format.\n\n" . "-- { $mime_boundary } \n" .
"Content-Type:text/html; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $email_message . "\n\n" ;
$data = chunk_split ( base64_encode ( $data ));
$email_message .= "-- { $mime_boundary } \n" . "Content-Type: { $fileatt_type } ;\n" . " name=\" { $fileatt_name } \"\n" .
//"Content-Disposition: attachment;\n" .
//" filename=\"{$fileatt_name}\"\n" .
"Content-Transfer-Encoding: base64\n\n" . $data . "\n\n" . "-- { $mime_boundary } --\n" ;
$ok = @ mail ( $email_to , $email_subject , $email_message , $headers );
if( $ok ) {
echo "<font face=verdana size=2>The file was successfully sent!</font>" ;
}else{
die( "Sorry but the email could not be sent. Please go back and try again!" );
}
?>
PHP based Contact email form with multiple recipients, text file based, supports departments. Categories : PHP , Email , Beginner Guides , Filesystem Massreplace Categories : Filesystem , Regexps , Strings , PHP Solution to those 'tell-a-friend' type email issues Categories : PHP , Email , Databases , MySQL A simple php file uploader Categories : PHP , Filesystem , HTML and PHP Recursive function to move files on a filesystem. It can be minor changed in order to copy recursively.
Categories : PHP , Filesystem , Algorithms Open directory and File download Categories : PHP , Filesystem , Directories , HTML and PHP 3 lines of Code to extract Tar, Zip, Gzip etc.. Categories : PHP , Filesystem , PHP Classes , Compression GuestBook Light - a plug and play application for any website. Categories : PHP , Complete Programs , Filesystem , Sessions QTO File Manager Categories : Filesystem , filePro , Complete Programs , PHP , Content Management how can I read the entire contents of a file into a string? Categories : Filesystem , Strings , PHP Clever Email Validation Function - E-Mail validation function with an eregi expression and socket connection. Categories : Email , PHP , Regexps Relative Path Categories : PHP , Filesystem PHP3 FormMail This script sends E-mail using PHP3 function mail(). Body of
message is from text file that you create. Easily modified. Categories : PHP , Email , IMAP Customer feedback or simple emailer - A PHP script that enables your visitors to send you emails.
Categories : PHP , Email , Form Processing Directory Viewer, Directory Content Viewer, Directory Structure to HTML.
This code will basically create a complete set of HTMLs to let a user
navigate through any directory you want. Excellent code for large file
sharing pages. Categories : Directories , Filesystem , PHP