@Override
    public void handle(SMTPServiceThread service, String com, String arg) {
        if (!"mail".equals(com)) {
            service.writeToClient("503 Error: need Mail command");
            return ;
        }
        if (!this.checkArgument(arg)) {
            service.writeToClient("501 Invalid argument");
            return ;
        }

        //check the mail whether is sent from local or not
        if (service.getType() == ServerType.FORCLIENT) {
            if (!Manager.isLocalServer(Manager.getMailServer(
                    this.getMail(arg)))) {
                service.writeToClient("550 Wrong mail address");
                return ;
            }

            // SMTPServer.logger.debug(this.getUsername(this.getMail(arg)));
            // SMTPServer.logger.debug(service.getReceiver().getMessage()
            //     .getUser().getUsername());

            if (!Manager.getMailUser(this.getMail(arg)).equals(
                        service.getReceiver().getMessage().getUser().getUsername())
               ) {
                service.writeToClient("553 You are not authorized to send " +
                                      "mail, authentication is required");
                return ;
            }
        }

        service.getReceiver().getMessage().setFrom(this.getMail(arg));

        service.writeToClient("250 Mail OK");

        service.getReceiver().setState(new RcptState());
    }