|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectatg.nucleus.logging.VariableArgumentApplicationLoggingImpl
atg.nucleus.GenericService
atg.nucleus.TimedOperationService
atg.service.email.SMTPEmailSender
public class SMTPEmailSender
This service can be used to send an email message with the SMTP protocol
Field Summary | |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string |
Fields inherited from class atg.nucleus.GenericService |
---|
SERVICE_INFO_KEY |
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging |
---|
DEFAULT_LOG_TRACE_STATUS |
Fields inherited from interface atg.nucleus.logging.ApplicationLogging |
---|
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS |
Constructor Summary | |
---|---|
SMTPEmailSender()
Constructs a SMTPEmailSender |
Method Summary | |
---|---|
void |
closeConnection(javax.mail.Transport pTransport)
Closes the connection identified by the Transport object. |
java.lang.String |
getCharSet()
Returns the default charSet |
java.lang.String |
getDefaultBcc()
Returns the default sender (Bcc:) field. |
java.lang.String |
getDefaultBody()
Returns the default message body, that should be prepended to all emails |
java.lang.String |
getDefaultCc()
Returns the default sender (Cc:) field. |
java.lang.String[] |
getDefaultExtraHeaders()
Returns the default list of extra headers that should be used in the email (e.g. |
java.lang.String |
getDefaultFrom()
Returns the default sender (From:) field. |
java.lang.String[] |
getDefaultRecipients()
Returns the default list of Recipients that should receive email |
java.lang.String |
getDefaultSubject()
Returns the default subject field. |
boolean |
getDummyMode()
Returns whether this component is in dummy mode, i.e. |
java.lang.String |
getEmailHandlerHostName()
Returns the SMTP host used to send email. |
int |
getEmailHandlerPort()
Returns the SMTP port used to send email. |
java.lang.String[] |
getInvalidSenderExceptionTags()
|
java.lang.String |
getPassword()
Returns the password used to authenticate on the SMTP server. |
int |
getRetryConnectionCount()
|
java.lang.String |
getSourceHostName()
Returns the hostname from which the email is coming from |
boolean |
getTestMode()
Returns whether this component is in test mode, i.e. |
java.lang.String |
getUsername()
Returns the user name used to authenticate on the SMTP server. |
int |
getWaitForConnectionMillis()
|
static void |
main(java.lang.String[] arguments)
|
javax.mail.Transport |
openConnection()
Opens a connection to the mail server using a separate thread. |
void |
printMessage(javax.mail.Message pMessage)
|
void |
printParts(javax.mail.Part p)
|
void |
sendEmailEvent(EmailEvent pEvent)
Takes the given event and sends if off as an email message |
void |
sendEmailMessage(javax.mail.Message pMessage)
Sends an email message. |
void |
sendEmailMessage(javax.mail.Message pMessage,
javax.mail.Transport pTransport)
Sends an email message. |
void |
sendEmailMessage(java.lang.String pBody)
Sends a message via SMTP with the given body, and using the default properties for the From, Recipients, and Subject fields. |
void |
sendEmailMessage(java.lang.String pFrom,
java.lang.String[] pRecipients,
java.lang.String pSubject,
java.lang.String pBody)
Sends a message via SMTP with the given parameters. |
void |
sendEmailMessage(java.lang.String pFrom,
java.lang.String[] pRecipients,
java.lang.String pSubject,
java.lang.String pBody,
java.lang.String pExtraHeader)
Sends a message via SMTP with the given parameters. |
void |
sendEmailMessage(java.lang.String pFrom,
java.lang.String[] pRecipients,
java.lang.String pSubject,
java.lang.String pBody,
java.lang.String[] pExtraHeaders)
Sends a message via SMTP with the given parameters. |
void |
sendEmailMessage(java.lang.String pFrom,
java.lang.String[] pRecipients,
java.lang.String pSubject,
java.lang.String pBody,
java.lang.String[] pExtraHeaders,
java.util.Map pTrackingData)
Sends a message via SMTP with the given parameters. |
void |
sendEmailMessage(java.lang.String pFrom,
java.lang.String pRecipient,
java.lang.String pSubject,
java.lang.String pBody)
Sends a message via SMTP with the given parameters. |
void |
sendEmailMessage(java.lang.String pFrom,
java.lang.String pRecipient,
java.lang.String pSubject,
java.lang.String pBody,
java.lang.String pExtraHeader)
Sends a message via SMTP with the given parameters. |
void |
sendEmailMessage(java.lang.String pFrom,
java.lang.String pRecipient,
java.lang.String pSubject,
java.lang.String pBody,
java.lang.String[] pExtraHeaders)
Sends a message via SMTP with the given parameters. |
void |
sendEmailMessage(java.lang.String pFrom,
java.lang.String pRecipient,
java.lang.String pSubject,
java.lang.String pBody,
java.lang.String[] pExtraHeaders,
java.util.Map pTrackingData)
Sends a message via SMTP with the given parameters. |
void |
setCharSet(java.lang.String pCharSet)
Sets the default charSet. |
void |
setDefaultBcc(java.lang.String pBcc)
Sets the default sender (Bcc:) field. |
void |
setDefaultBody(java.lang.String pBody)
Sets the default message body, that should be prepended to all emails |
void |
setDefaultCc(java.lang.String pCc)
Sets the default sender (Cc:) field. |
void |
setDefaultExtraHeaders(java.lang.String[] pExtraHeaders)
Sets the default list of extra headers that should be used in the email (e.g. |
void |
setDefaultFrom(java.lang.String pFrom)
Sets the default sender (From:) field. |
void |
setDefaultRecipients(java.lang.String[] pRecipients)
Sets the default list of Recipients that should receive email |
void |
setDefaultSubject(java.lang.String pSubject)
Sets the default subject field. |
void |
setDummyMode(boolean pDummyMode)
Sets this component in dummy mode, i.e. |
void |
setEmailHandlerHostName(java.lang.String pHost)
Sets the SMTP host used to send email. |
void |
setEmailHandlerPort(int pPort)
Sets the SMTP port used to send email. |
void |
setInvalidSenderExceptionTags(java.lang.String[] pInvalidSenderExceptionTags)
|
void |
setPassword(java.lang.String pPassword)
Sets the password used to authenticate on the SMTP server. |
void |
setRetryConnectionCount(int pRetryConnectionCount)
|
void |
setSourceHostName(java.lang.String pHostName)
Sets the hostname from which the email is coming from |
void |
setTestMode(boolean pTestMode)
Sets this component in test mode, i.e. |
void |
setUsername(java.lang.String pUsername)
Sets the user name used to authenticate on the SMTP server. |
void |
setWaitForConnectionMillis(int pWait)
|
Methods inherited from class atg.nucleus.TimedOperationService |
---|
getAverageRequestHandlingTime, getHandledRequestCount, getRequestStartTime, getTotalRequestHandlingTime, isKeepingStatistics, notifyHandledRequest, resetStatistics, setKeepingStatistics |
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl |
---|
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.String CLASS_VERSION
Constructor Detail |
---|
public SMTPEmailSender()
Method Detail |
---|
public java.lang.String[] getInvalidSenderExceptionTags()
public void setInvalidSenderExceptionTags(java.lang.String[] pInvalidSenderExceptionTags)
public java.lang.String[] getDefaultRecipients()
public void setDefaultRecipients(java.lang.String[] pRecipients)
public boolean getTestMode()
public void setTestMode(boolean pTestMode)
pTestMode
- true if this component is to be in test modepublic boolean getDummyMode()
public void setDummyMode(boolean pDummyMode)
pDummyMode
- true if this component is to be in dummy modepublic java.lang.String getCharSet()
public void setCharSet(java.lang.String pCharSet)
public java.lang.String getDefaultFrom()
public void setDefaultFrom(java.lang.String pFrom)
public java.lang.String getDefaultCc()
public void setDefaultCc(java.lang.String pCc)
public java.lang.String getDefaultBcc()
public void setDefaultBcc(java.lang.String pBcc)
public java.lang.String getDefaultSubject()
public void setDefaultSubject(java.lang.String pSubject)
public java.lang.String[] getDefaultExtraHeaders()
"X-URL: http://foo.bar.com/"
)
public void setDefaultExtraHeaders(java.lang.String[] pExtraHeaders)
"X-URL: http://foo.bar.com/"
)
public java.lang.String getDefaultBody()
public void setDefaultBody(java.lang.String pBody)
public java.lang.String getEmailHandlerHostName()
public void setEmailHandlerHostName(java.lang.String pHost)
public int getEmailHandlerPort()
public void setEmailHandlerPort(int pPort)
public java.lang.String getUsername()
public void setUsername(java.lang.String pUsername)
pUsername
- user name used to authenticate on the SMTP serverpublic java.lang.String getPassword()
public void setPassword(java.lang.String pPassword)
pPassword
- password used to authenticate on the SMTP serverpublic java.lang.String getSourceHostName()
public void setSourceHostName(java.lang.String pHostName)
public int getRetryConnectionCount()
public void setRetryConnectionCount(int pRetryConnectionCount)
public int getWaitForConnectionMillis()
public void setWaitForConnectionMillis(int pWait)
public void sendEmailMessage(java.lang.String pBody) throws EmailException
pBody
- The message content
EmailException
- if there is any problem while sending mailpublic void sendEmailMessage(java.lang.String pFrom, java.lang.String pRecipient, java.lang.String pSubject, java.lang.String pBody) throws EmailException
sendEmailMessage
in interface EmailSender
pFrom
- Whom the mail is coming frompRecipient
- The recipient that should receive the messagepSubject
- Subject line of the email messagepBody
- The message content
EmailException
- if there is any problem while sending mailpublic void sendEmailMessage(java.lang.String pFrom, java.lang.String pRecipient, java.lang.String pSubject, java.lang.String pBody, java.lang.String pExtraHeader) throws EmailException
sendEmailMessage
in interface EmailSender
pFrom
- Whom the mail is coming frompRecipient
- The recipient that should receive the messagepSubject
- Subject line of the email messagepBody
- The message contentpExtraHeader
- An extra headers that should be used
in the email (e.g. "X-URL: http://foo.bar.com/"
)
EmailException
- if there is any problem while sending mailpublic void sendEmailMessage(java.lang.String pFrom, java.lang.String[] pRecipients, java.lang.String pSubject, java.lang.String pBody) throws EmailException
sendEmailMessage
in interface EmailSender
pFrom
- Whom the mail is coming frompRecipients
- The list of recipients that should receive emailpSubject
- Subject line of the email messagepBody
- The message content
EmailException
- if there is any problem while sending mailpublic void sendEmailMessage(java.lang.String pFrom, java.lang.String pRecipient, java.lang.String pSubject, java.lang.String pBody, java.lang.String[] pExtraHeaders) throws EmailException
sendEmailMessage
in interface EmailSender
pFrom
- Whom the mail is coming frompRecipient
- The recipient that should receive the messagepSubject
- Subject line of the email messagepBody
- The message contentpExtraHeaders
- The list of extra headers that should be used
in the email (e.g. "X-URL: http://foo.bar.com/"
)
EmailException
- if there is any problem while sending mailpublic void sendEmailMessage(java.lang.String pFrom, java.lang.String[] pRecipients, java.lang.String pSubject, java.lang.String pBody, java.lang.String pExtraHeader) throws EmailException
sendEmailMessage
in interface EmailSender
pFrom
- Whom the mail is coming frompRecipients
- The list of recipients that should receive emailpSubject
- Subject line of the email messagepBody
- The message contentpExtraHeader
- An extra headers that should be used
in the email (e.g. "X-URL: http://foo.bar.com/"
)
EmailException
- if there is any problem while sending mailpublic void sendEmailMessage(java.lang.String pFrom, java.lang.String[] pRecipients, java.lang.String pSubject, java.lang.String pBody, java.lang.String[] pExtraHeaders) throws EmailException
sendEmailMessage
in interface EmailSender
pFrom
- Whom the mail is coming frompRecipients
- The list of recipients that should receive emailpSubject
- Subject line of the email messagepBody
- The message contentpExtraHeaders
- The list of extra headers that should be used
in the email (e.g. "X-URL: http://foo.bar.com/"
)
EmailException
- if there is any problem while sending mailpublic void sendEmailMessage(java.lang.String pFrom, java.lang.String pRecipient, java.lang.String pSubject, java.lang.String pBody, java.lang.String[] pExtraHeaders, java.util.Map pTrackingData) throws EmailException
sendEmailMessage
in interface atg.service.email.TrackableEmailSender
pFrom
- Whom the mail is coming frompRecipient
- The recipient that should receive the messagepSubject
- Subject line of the email messagepBody
- The message contentpExtraHeaders
- The list of extra headers that should be used
in the email (e.g. "X-URL: http://foo.bar.com/"
)pTrackingData
- NV pair data to associate with the out-bound email.
EmailException
- if there is any problem while sending mailpublic void sendEmailMessage(java.lang.String pFrom, java.lang.String[] pRecipients, java.lang.String pSubject, java.lang.String pBody, java.lang.String[] pExtraHeaders, java.util.Map pTrackingData) throws EmailException
sendEmailMessage
in interface atg.service.email.TrackableEmailSender
pFrom
- Whom the mail is coming frompRecipients
- The list of recipients that should receive emailpSubject
- Subject line of the email messagepBody
- The message contentpExtraHeaders
- The list of extra headers that should be used
in the email (e.g. "X-URL: http://foo.bar.com/"
)pTrackingData
- NV pair data to associate with the out-bound email.
EmailException
- if there is any problem while sending mailpublic javax.mail.Transport openConnection() throws EmailException
openConnection
in interface EmailMessageSender
EmailException
- if the connection could not be
openedpublic void sendEmailMessage(javax.mail.Message pMessage, javax.mail.Transport pTransport) throws EmailException
sendEmailMessage
in interface EmailMessageSender
EmailException
- if the connection is not open,
or if the message could not be sentpublic void sendEmailMessage(javax.mail.Message pMessage) throws EmailException
sendEmailMessage
in interface EmailMessageSender
EmailException
- if the message could not be sentpublic void closeConnection(javax.mail.Transport pTransport) throws EmailException
closeConnection
in interface EmailMessageSender
EmailException
- if the connection could not be
closedpublic void sendEmailEvent(EmailEvent pEvent) throws EmailException
sendEmailEvent
in interface EmailListener
EmailException
- if the email could not be sentpublic void printMessage(javax.mail.Message pMessage)
public void printParts(javax.mail.Part p)
public static void main(java.lang.String[] arguments)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |