Class EMailSender
- java.lang.Object
-
- com.logicaldoc.core.communication.EMailSender
-
public class EMailSender extends Object
SMTP E-Mail sender service- Author:
- Michael Scholz, Matteo Caruso - LogicalDOC
-
-
Field Summary
Fields Modifier and Type Field Description static int
SECURITY_NONE
static int
SECURITY_SSL
static int
SECURITY_TLS
static int
SECURITY_TLS_IF_AVAILABLE
-
Constructor Summary
Constructors Constructor Description EMailSender()
EMailSender(long tenant)
EMailSender(String tenant)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getConnectionSecurity()
String
getHost()
String
getPassword()
int
getPort()
String
getSender()
String
getUsername()
boolean
isAuthEncripted()
void
send(EMail email)
This method sends an email using the smtp-protocol.void
send(EMail email, String templateName, Map<String,Object> dictionary)
Sends an email by using a given templatevoid
sendAsync(EMail email)
Same as send(EMail) but executes in another threadvoid
sendAsync(EMail email, String templateName, Map<String,Object> dictionary)
Same as send(EMail, String, Map) but executes in another threadvoid
setAuthEncripted(boolean authEncripted)
void
setConnectionSecurity(int connectionSecurity)
void
setHost(String host)
void
setPassword(String password)
void
setPort(int port)
void
setSender(String sender)
void
setUsername(String username)
-
-
-
Field Detail
-
SECURITY_NONE
public static final int SECURITY_NONE
- See Also:
- Constant Field Values
-
SECURITY_TLS_IF_AVAILABLE
public static final int SECURITY_TLS_IF_AVAILABLE
- See Also:
- Constant Field Values
-
SECURITY_TLS
public static final int SECURITY_TLS
- See Also:
- Constant Field Values
-
SECURITY_SSL
public static final int SECURITY_SSL
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
EMailSender
public EMailSender(long tenant)
-
EMailSender
public EMailSender(String tenant)
-
EMailSender
public EMailSender()
-
-
Method Detail
-
getSender
public String getSender()
-
setSender
public void setSender(String sender)
-
getHost
public String getHost()
-
setHost
public void setHost(String host)
-
getPassword
public String getPassword()
-
setPassword
public void setPassword(String password)
-
getPort
public int getPort()
-
setPort
public void setPort(int port)
-
getUsername
public String getUsername()
-
setUsername
public void setUsername(String username)
-
sendAsync
public void sendAsync(EMail email, String templateName, Map<String,Object> dictionary)
Same as send(EMail, String, Map) but executes in another thread- Parameters:
email
- the email to sendtemplateName
- the template to use to render the body of the message using the automation enginedictionary
- map of variable to pass to the automation
-
send
public void send(EMail email, String templateName, Map<String,Object> dictionary) throws Exception
Sends an email by using a given template- Parameters:
email
- The email to sendtemplateName
- Name of the template to be applieddictionary
- The dictionary to be used in the template- Throws:
Exception
- raised if the message cannot be sent
-
sendAsync
public void sendAsync(EMail email)
Same as send(EMail) but executes in another thread- Parameters:
email
- the email to send
-
send
public void send(EMail email) throws Exception
This method sends an email using the smtp-protocol. The email can be a simple mail or a multipart mail containing up to 5 attachments.- Parameters:
email
- E-Mail which should be sent.- Throws:
Exception
- raised if the email cannot be sent
-
isAuthEncripted
public boolean isAuthEncripted()
-
setAuthEncripted
public void setAuthEncripted(boolean authEncripted)
-
getConnectionSecurity
public int getConnectionSecurity()
-
setConnectionSecurity
public void setConnectionSecurity(int connectionSecurity)
-
-