1
hi
i want send email with attach file
please see my code and said me my problem
this code send email with attach file
but when i check my email
said to me this file didnt scan
and when i save a file i cant open that
$to = $email;
$from = "John-Smith ";
$subject = "Here is your attachment";
$fileatt = "/home5/modules/referee/upload/ABSTRACT-2007-08-27-824925.PDF";
$fileatttype = "application/pdf";
$fileattname = "newpaper.pdf";
$headers = 'From: 4hncce ' ;
$file = fopen( $fileattname, 'rb' );
$data = fread( $file, filesize( $fileatt ) );
fclose( $file );
$semi_rand = md5( time() );
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
$headers .= "nMIME-Version: 1.0n" .
"Content-Type: multipart/mixed;n" .
" boundary="{$mime_boundary}"";
$message ="hi all it is for you";
$message .= "This is a multi-part message in MIME format.nn" .
"--{$mime_boundary}n" .
.
"Content-Type: text/plain; charset="iso-8859-1"n" .
"Content-Transfer-Encoding: 7bitnn"
$message . "nn";
$data = chunk_split( base64_encode( $data ) );
$message .= "--{$mime_boundary}n" .
"Content-Type: {$fileatttype};n" .
" name="{$fileattname}"n" .
"Content-Disposition: attachment;n" .
" filename="{$fileattname}"n" .
"Content-Transfer-Encoding: base64nn" .
$data . "nn" .
"--{$mime_boundary}--n";
if( mail( $to, $subject, $message, $headers ) ) {
echo "The email was sent.
";
}
else {
echo "There was an error sending the mail.
";
}