private void saveMailsLocalyByFireingUIDLandRETRandDELE(int amount)	throws IOException {
		String reply = "";
		String uidlOfMail = "";

		for (int i = 1; i <= amount; i++) {
			// firering UIDL

			writeToServer("UIDL " + i); 

			reply = readFromServer(); 

			uidlOfMail = reply.split(" ")[2];
			
			
			// firering RETR

			writeToServer("RETR " + i);
			reply = readFromMailServer();

			if (reply.startsWith("-Err")) {
				closeConnection();
			} else {

				while (!(reply = readFromMailServer()).equals(".")) {
					if (reply.startsWith("..") && reply.length() > 1){
						reply = reply.substring(1);
					}					

					MailWriter.writeMail(uidlOfMail, reply);

				}
			}
			
			//firering DELE
			if(user.keepCopyOnServer()==false){
				writeToServer("DELE " + i);
				readFromServer();
			}
		}

		
	}