if (uri.startsWith("smtp")) { return new SmtpSender(uri); } else { throw new MessagingException("Unable to locate an applicable Transport for " + uri); }