Java Code Examples for javax.mail.Session#getProperty()

The following examples show how to use javax.mail.Session#getProperty() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JavaMailSenderImpl.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Obtain a Transport object from the given JavaMail Session,
 * using the configured protocol.
 * <p>Can be overridden in subclasses, e.g. to return a mock Transport object.
 * @see javax.mail.Session#getTransport(String)
 * @see #getSession()
 * @see #getProtocol()
 */
protected Transport getTransport(Session session) throws NoSuchProviderException {
	String protocol	= getProtocol();
	if (protocol == null) {
		protocol = session.getProperty("mail.transport.protocol");
		if (protocol == null) {
			protocol = DEFAULT_PROTOCOL;
		}
	}
	return session.getTransport(protocol);
}
 
Example 2
Source File: JavaMailSenderImpl.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Obtain a Transport object from the given JavaMail Session,
 * using the configured protocol.
 * <p>Can be overridden in subclasses, e.g. to return a mock Transport object.
 * @see javax.mail.Session#getTransport(String)
 * @see #getSession()
 * @see #getProtocol()
 */
protected Transport getTransport(Session session) throws NoSuchProviderException {
	String protocol	= getProtocol();
	if (protocol == null) {
		protocol = session.getProperty("mail.transport.protocol");
		if (protocol == null) {
			protocol = DEFAULT_PROTOCOL;
		}
	}
	return session.getTransport(protocol);
}
 
Example 3
Source File: JavaMailSenderImpl.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Obtain a Transport object from the given JavaMail Session,
 * using the configured protocol.
 * <p>Can be overridden in subclasses, e.g. to return a mock Transport object.
 * @see javax.mail.Session#getTransport(String)
 * @see #getSession()
 * @see #getProtocol()
 */
protected Transport getTransport(Session session) throws NoSuchProviderException {
	String protocol	= getProtocol();
	if (protocol == null) {
		protocol = session.getProperty("mail.transport.protocol");
		if (protocol == null) {
			protocol = DEFAULT_PROTOCOL;
		}
	}
	return session.getTransport(protocol);
}
 
Example 4
Source File: JavaMailSenderImpl.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Obtain a Transport object from the given JavaMail Session,
 * using the configured protocol.
 * <p>Can be overridden in subclasses, e.g. to return a mock Transport object.
 * @see javax.mail.Session#getTransport(String)
 * @see #getSession()
 * @see #getProtocol()
 */
protected Transport getTransport(Session session) throws NoSuchProviderException {
	String protocol	= getProtocol();
	if (protocol == null) {
		protocol = session.getProperty("mail.transport.protocol");
		if (protocol == null) {
			protocol = DEFAULT_PROTOCOL;
		}
	}
	return session.getTransport(protocol);
}
 
Example 5
Source File: MailSenderTestBase.java    From iaf with Apache License 2.0 5 votes vote down vote up
private void validateAuthentication(Session session) {
	String user = session.getProperty("login.user");
	String pass = session.getProperty("login.pass");

	assertEquals("user123", user);
	assertEquals("secret321", pass);
}
 
Example 6
Source File: MailSenderTestBase.java    From iaf with Apache License 2.0 4 votes vote down vote up
private void validateNDR(Session session, String ndr) {
	String from = session.getProperty("mail.smtp.from");
	log.debug("mail NDR address ["+from+"]");

	assertEquals(ndr, from);
}