Mail manipulation based on imap extension of php