code: public boolean isEmailAvailable() throws SmackException, InterruptedException {
          ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(connection);
  
          try {
              DomainBareJid workgroupService = workgroupJID.asDomainBareJid();
              DiscoverInfo infoResult = discoManager.discoverInfo(workgroupService);
              return infoResult.containsFeature("jive:email:provider");
          }
          catch (XMPPException e) {
              return false;
          }
      }
docs: The workgroup service may be configured to send email. This queries the Workgroup Service
  to see if the email service has been configured and is available.
  
  @return true if the email service is available, otherwise return false.
  @throws SmackException
  @throws InterruptedException