public static String send(User user,Mail mail) throws IOException{
	
		String from = mail.getFrom();
		String to = mail.getTo();
		String cc = mail.getCc();
		String bcc = mail.getBcc();
		
		String mailContent = new MailEncoder().transformMIME(mail,1);
		
		BASE64Encoder encoder = new BASE64Encoder();//BASE64ת		
		String encodedUser = encoder.encode(user.getUsername().getBytes());
		String encodedPswd = encoder.encode(user.getPassword().getBytes());		
		String hostName = InetAddress.getLocalHost().getHostName();
		
		Socket s = new Socket(user.getSmtpServer(),25);
		
		BufferedReader inFromServer = new BufferedReader(//Ӧ
				new InputStreamReader(s.getInputStream()));		
		PrintWriter outToServer = new PrintWriter(//ͻ˷
				s.getOutputStream(),true);
		
		String response = inFromServer.readLine();		
		System.out.println(response);
		if(response.indexOf("220")==-1) return "ʧ";
					
		response = exchange("EHLO "+hostName, inFromServer, outToServer);
		System.out.println(response);
		if(response.indexOf("250")==-1) return "޷ӷ";
		
		response = exchange("AUTH LOGIN", inFromServer, outToServer);
		while(response.indexOf("250")!=-1){
			System.out.println(response);
			response = inFromServer.readLine();
		}
		System.out.println(response);
		if(response.indexOf("334")==-1) return "޷֤";			
			
		response = exchange(encodedUser, inFromServer, outToServer);
		System.out.println("3.MailServer:"+response+"û");   //Password:
		if(response.indexOf("334")==-1) return "ûǷ";
		
		response = exchange(encodedPswd, inFromServer, outToServer);
		System.out.println("4.MailServer:"+response+"");
		if(response.indexOf("235")==-1) return "";
		
		response = exchange("MAIL FROM:<"+from+"> BODY=8BITMIME", inFromServer, outToServer);
		System.out.println("5.MailServer:"+response);
		if(response.indexOf("250")==-1) return "˷Ƿ";

		
		System.out.println("6.Client:"+"RCPT TO:"+to);	
		response = exchange("RCPT TO:<"+to+">", inFromServer, outToServer);
		System.out.println("6.MailServer:"+response);
		if(response.indexOf("250")==-1) return "ռ˷Ƿ";
		
		if(!"".equals(cc)){
			response = exchange("RCPT TO:<"+cc+">", inFromServer, outToServer);
			System.out.println("6.MailServer:"+response);
			if(response.indexOf("250")==-1) return "˷Ƿ";
		}
		if(!"".equals(bcc)){
			response = exchange("RCPT TO:<"+bcc+">", inFromServer, outToServer);
			System.out.println("6.MailServer:"+response);
			if(response.indexOf("250")==-1) return "˷Ƿ";
		}
		
		response = exchange("DATA", inFromServer, outToServer);	
		System.out.println("7.MailServer:"+response);
		if(response.indexOf("354")==-1) return "޷ʼ";

		outToServer.println(mailContent);		
		response = exchange(".", inFromServer, outToServer);
		System.out.println("MailServer:"+response);
		if(response.indexOf("250")==-1) return "ʧ";
		System.out.println("8.MailServer:"+response);
		
		response = exchange("QUIT", inFromServer, outToServer);
		System.out.println("8.MailServer:"+inFromServer.readLine());
		s.close();
		return "ͳɹ";
	}