Refine search
throw new NoSuchProviderException("Invalid protocol: null"); String _className = props.getProperty("mail."+protocol+".class"); if (_className != null) { if (logger.isLoggable(Level.FINE)) { _className); _provider = getProviderByClassName(_className); _provider = getProviderByProtocol(protocol); throw new NoSuchProviderException("No provider for " + protocol); } else { if (logger.isLoggable(Level.FINE)) {
Properties mailProps = new Properties(); mailProps.setProperty("mail.debug", String.valueOf(debugEnabled)); Session session = Session.getInstance(mailProps, null); Store store; try { store = session.getStore(useSSL ? "pop3s" : "pop3"); Log.error(e.getMessage(), e); throw new UnauthorizedException(e);
Properties props = new Properties(); props.put("mail.smtp.host", smtpHost); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.starttls.enable", "true"); Session session = Session.getInstance(props); session.setDebug(debug); try { Transport t = session.getTransport("smtp"); t.connect(smtpHost, userName, password); LOGGER.warn("NoSuchProviderException " + e.getMessage()); LOGGER.warn("NoSuchProviderException " + e.getStackTrace()); } catch (MessagingException e) { LOGGER.warn("MessagingException " + e.getMessage());
@Override public void init(Map<String, String> properties) throws EmailConnectorException { Properties serverProperties = new Properties(); properties.forEach((key, value) -> { if (key.startsWith("mail.smtp") || key.startsWith("mail.store")) { serverProperties.put(key, value); session = Session.getInstance(serverProperties, new EmailAuthenticator(username, password)); transport = session.getTransport(); transport.connect(); } catch (NoSuchProviderException e) { throw new EmailConnectorException( "Error is encountered while creating transport" + " using the session." + e.getMessage(), e); } catch (MessagingException e) { throw new EmailConnectorException(
Properties serverProperties = new Properties(); emailProperties.forEach((k, v) -> { if (k.startsWith("mail." + storeType)) { serverProperties.put(k, v); session = Session.getInstance(serverProperties); store = session.getStore(storeType); } catch (NoSuchProviderException e) { throw new EmailConnectorException( "Couldn't initialize the store '" + storeType + "' in the email server connector for service id: " + serviceId + "." + e.getMessage(), e);
/** * Set the passed Provider to be the default implementation * for the protocol in Provider.protocol overriding any previous values. * * @param provider Currently configured Provider which will be * set as the default for the protocol * @exception NoSuchProviderException If the provider passed in * is invalid. */ public synchronized void setProvider(Provider provider) throws NoSuchProviderException { if (provider == null) { throw new NoSuchProviderException("Can't set null provider"); } providersByProtocol.put(provider.getProtocol(), provider); props.put("mail." + provider.getProtocol() + ".class", provider.getClassName()); }
/** * Return a Transport for the default protocol specified by the * <code>mail.transport.protocol</code> property. * * @return a Transport * @throws NoSuchProviderException */ public Transport getTransport() throws NoSuchProviderException { String protocol = properties.getProperty("mail.transport.protocol"); if (protocol == null) { throw new NoSuchProviderException("mail.transport.protocol property is not set"); } return getTransport(protocol); }
/** * Return a Store for the default protocol defined by the mail.store.protocol property. * * @return the store for the default protocol * @throws NoSuchProviderException */ public Store getStore() throws NoSuchProviderException { String protocol = properties.getProperty("mail.store.protocol"); if (protocol == null) { throw new NoSuchProviderException("mail.store.protocol property is not set"); } return getStore(protocol); }
ProviderInfo info = getProviderInfo(); Provider provider = null; String providerName = properties.getProperty("mail." + protocol + ".class"); if (providerName != null) { provider = (Provider) info.byClassName.get(providerName); if (debug) { writeDebug("DEBUG: new provider loaded: " + provider.toString()); throw new NoSuchProviderException("Unable to locate provider for protocol: " + protocol); writeDebug("DEBUG: getProvider() returning provider " + provider.toString());
throw new NoSuchProviderException("Invalid protocol: null"); String _className = props.getProperty("mail."+protocol+".class"); if (_className != null) { if (debug) { pr("DEBUG: mail."+protocol+ ".class property exists and points to " + _className); throw new NoSuchProviderException("No provider for " + protocol); } else { if (debug) { pr("DEBUG: getProvider() returning " + _provider.toString());
throw new NoSuchProviderException("Invalid protocol: null"); String _className = props.getProperty("mail."+protocol+".class"); if (_className != null) { if (logger.isLoggable(Level.FINE)) { throw new NoSuchProviderException("No provider for " + protocol); } else { if (logger.isLoggable(Level.FINE)) {
/** * Get a Transport object that can transport a Message of the * specified address type. * * @param address an address for which a Transport is needed * @return A Transport object * @see javax.mail.Address * @exception NoSuchProviderException If provider for the * Address type is not found */ public Transport getTransport(Address address) throws NoSuchProviderException { String transportProtocol; transportProtocol = getProperty("mail.transport.protocol." + address.getType()); if (transportProtocol != null) return getTransport(transportProtocol); transportProtocol = (String)addressMap.get(address.getType()); if (transportProtocol != null) return getTransport(transportProtocol); throw new NoSuchProviderException("No provider for Address type: "+ address.getType()); }
props.setProperty("mail.imap.partialfetch", "false"); Session session = Session.getDefaultInstance(props, null); try store = session.getStore("imap"); store.connect(REMOTE_HOST, ADMIN_USER_NAME, ADMIN_USER_NAME); Folder[] folders = null; e.printStackTrace();
/** * Get a Transport object that can transport a Message to the * specified address type. * * @param address * @return A Transport object * @see javax.mail.Address * @exception NoSuchProviderException If provider for the * Address type is not found */ public Transport getTransport(Address address) throws NoSuchProviderException { String transportProtocol = (String)addressMap.get(address.getType()); if (transportProtocol == null) { throw new NoSuchProviderException("No provider for Address type: "+ address.getType()); } else { return getTransport(transportProtocol); } }
} else { if (LOGGER.isDebugEnabled()) { mailSession.setDebug(true); transport = mailSession.getTransport(mailAddress); } catch (NoSuchProviderException e) { LOGGER.error("No provider found for @: {} \n {}", addrs, e.getMessage()); return;
/** * Return a transport for the protocol associated with the type of this address. * * @param address the address we are trying to deliver to * @return a Transport * @throws NoSuchProviderException */ public Transport getTransport(Address address) throws NoSuchProviderException { String type = address.getType(); // load the address map from the resource files. Map addressMap = getAddressMap(); String protocolName = (String)addressMap.get(type); if (protocolName == null) { throw new NoSuchProviderException("No provider for address type " + type); } return getTransport(protocolName); }
@Override public boolean matches(Session value) { try { return value.getTransport(provider) != null; } catch (NoSuchProviderException e) { throw SeedException .wrap(e, MailAssertionsErrorCodes.NO_SUCH_PROVIDER_FOUND) .put("more", "\n" + e.getMessage()); } } });
public void sendWarningMail(final String log) { MessageContext context = mimePartDatasource.getMessageContext(); Message message = context.getMessage(); try { message.setContent(log, "text/plain"); } catch (MessagingException e) { System.err.println("Cannot set message content:" + e.getMessage()); e.printStackTrace(System.err); return; } Transport transport = null; try { transport = mailSession.getTransport(); } catch (NoSuchProviderException e) { e.printStackTrace(System.err); return; } try { transport.connect(); transport.sendMessage(message, mimePartDatasource.getMessageContext().getMessage().getAllRecipients()); transport.close(); } catch (MessagingException e) { System.err.println("Cannot send message:" + e.getMessage()); e.printStackTrace(System.err); return; } }
/** * Get a Transport object using the given provider and urlname. * * @param provider the provider to use * @param url urlname to use (can be null) * @return A Transport object * @exception NoSuchProviderException If no provider or the provider * was the wrong class. */ private Transport getTransport(Provider provider, URLName url) throws NoSuchProviderException { // make sure we have the correct type of provider if (provider == null || provider.getType() != Provider.Type.TRANSPORT) { throw new NoSuchProviderException("invalid provider"); } return getService(provider, url, Transport.class); }
throw new NoSuchProviderException("null"); try { ClassLoader ccl = getContextClassLoader(); if (ccl != null) try { throw new NoSuchProviderException(provider.getProtocol()); throw new NoSuchProviderException(provider.getProtocol());