Package org.alfresco.repo.mail
Class AlfrescoJavaMailSender
java.lang.Object
org.springframework.mail.javamail.JavaMailSenderImpl
org.alfresco.repo.mail.AlfrescoJavaMailSender
- All Implemented Interfaces:
org.springframework.mail.javamail.JavaMailSender,org.springframework.mail.MailSender
public class AlfrescoJavaMailSender
extends org.springframework.mail.javamail.JavaMailSenderImpl
This class extends Spring's
JavaMailSenderImpl to pool the Transports used to send emails.
This is to overcome problems reported in CLOUD-313.- Author:
- Alex Miller
-
Field Summary
Fields inherited from class org.springframework.mail.javamail.JavaMailSenderImpl
DEFAULT_PORT, DEFAULT_PROTOCOL -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected jakarta.mail.TransportgetTransport(jakarta.mail.Session session) voidsetMaxActive(int maxActive) Set the maximum number of active transports, managed by the pool.voidsetMaxIdle(int maxIdle) Set the maximum number of transports that can sit idle in the pool.voidsetMaxWait(long maxWait) Set the maximum amount of time (in milliseconds) to wait for a transport to be returned from the pool.voidsetMinEvictableIdleTime(long time) Set the minimum amount of time a transport may sit idle, before it is eligible for eviction.voidsetPassword(String password) voidsetTimeBetweenEvictionRuns(long time) Set the time (in milliseconds) between runs of the idle object eviction thread.voidsetUsername(String userName) Methods inherited from class org.springframework.mail.javamail.JavaMailSenderImpl
connectTransport, createMimeMessage, createMimeMessage, doSend, getDefaultEncoding, getDefaultFileTypeMap, getHost, getJavaMailProperties, getPassword, getPort, getProtocol, getSession, getUsername, send, send, setDefaultEncoding, setDefaultFileTypeMap, setHost, setJavaMailProperties, setPort, setProtocol, setSession, testConnectionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.mail.javamail.JavaMailSender
send, send, sendMethods inherited from interface org.springframework.mail.MailSender
send
-
Constructor Details
-
AlfrescoJavaMailSender
public AlfrescoJavaMailSender()
-
-
Method Details
-
getTransport
protected jakarta.mail.Transport getTransport(jakarta.mail.Session session) throws jakarta.mail.NoSuchProviderException - Overrides:
getTransportin classorg.springframework.mail.javamail.JavaMailSenderImpl- Returns:
- A new
PooledTransportWrapperwhich borrows a pooledTransporton connect, and returns it to the pool on close. - Throws:
jakarta.mail.NoSuchProviderException
-
setMaxActive
public void setMaxActive(int maxActive) Set the maximum number of active transports, managed by the pool. Use a negative value for no limit. Default is -1. -
setMaxIdle
public void setMaxIdle(int maxIdle) Set the maximum number of transports that can sit idle in the pool. Use a negative value for no limit. Default is 8. -
setMaxWait
public void setMaxWait(long maxWait) Set the maximum amount of time (in milliseconds) to wait for a transport to be returned from the pool. Set to 0 or less to block indefinitely. -
setTimeBetweenEvictionRuns
public void setTimeBetweenEvictionRuns(long time) Set the time (in milliseconds) between runs of the idle object eviction thread. Set to non-positive for no eviction. Default value is 30 seconds. -
setMinEvictableIdleTime
public void setMinEvictableIdleTime(long time) Set the minimum amount of time a transport may sit idle, before it is eligible for eviction. Set to non positive prevent eviction based on idle time. This value has no affect if timeBetweenEvictionRuns is non positive. Default value is 30 seconds. -
setUsername
- Overrides:
setUsernamein classorg.springframework.mail.javamail.JavaMailSenderImpl
-
setPassword
- Overrides:
setPasswordin classorg.springframework.mail.javamail.JavaMailSenderImpl
-