private function _setParams($params, $keys, $required = true)
    {
        foreach ( $keys as $key ) {

            if (!array_key_exists($key, $params)) {
                if ($required == true) {
                    throw new EmailException("Required configuration key '{$key}' was not found.");
                } else {
                    continue;
                }
            }

            switch ( strtolower($key) ) {
            case 'charset':
                $this->mailer->CharSet = $params['charset'];
                break;

            case 'content-type':
                $this->mailer->ContentType = $params['content-type'];
                break;

            case 'encoding':
                $this->mailer->Encoding = $params['encoding'];
                break;

            case 'helo':
                $this->mailer->Helo = $params['helo'];
                break;

            case 'host':
                $this->mailer->Host = $params['host'];
                break;

            case 'hostname':
                $this->mailer->Hostname = $params['hostname'];
                break;

            case 'message-id':
                $this->mailer->MessageId = $params['message-id'];
                break;

            case 'password':
                $this->mailer->Password = $params['password'];
                break;

            case 'port':
                $this->mailer->Port = $params['port'];
                break;

            case 'priority':
                $this->mailer->Priority = $params['priority'];
                break;

            case 'smtp-debug':
                // $this->_check_key($params, 'smtp-debug');
                $this->mailer->SMTPDebug = json_decode($params['smtp-debug']);
                break;

            case 'smtp-keepalive':
                // $this->_check_key($params, 'smtp-keepalive');
                $this->mailer->SMTPKeepAlive = json_decode($params['smtp-keepalive']);
                break;

            case 'smtp-secure':
                $this->mailer->SMTPSecure = $params['smtp-secure'];
                break;

            case 'sendmail':
                $this->mailer->Sendmail = $params['sendmail'];
                break;

            case 'timeout':
                $this->mailer->Timeout = $params['timeout'];
                break;

            case 'username':
                $this->mailer->Username = $params['username'];
                break;

            default:
                throw new EmailException("Parameter '{$key}' not supported.");
            }
        }
    }