heres my script what the problem is that it ignores the if statemenet after a while if($type==".eml"........
$directory2=opendir(".");
while( $file2 = readdir( $directory2 ) )
{
$file2_ar[] = $file2;
}
foreach( $file2_ar as $file2 )
{
if( $file2 == ".." || $file2 == "." )
{
continue;
}
$type2= strrchr($file2,'.');
echo "<BR>".$type2;
if($type2=='.eml')
{
copy($file2,"userfolder/$sent22/inbox/$file2");
copy($file2,"recieved/$file2");
}