|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.opengts.util.SendMail
public class SendMail
Nested Class Summary | |
---|---|
static class |
SendMail.Args
A container for the arguments of an email |
static class |
SendMail.Attachment
A container for an email attachment |
static class |
SendMail.SendMailException
SendMailException |
static class |
SendMail.SmtpProperties
|
Field Summary | |
---|---|
static int |
_THREAD_CURRENT
|
static int |
_THREAD_DEBUG
|
static int |
_THREAD_NEW
|
static int |
_THREAD_NONE
|
static int |
_THREAD_POOL
|
static java.lang.String |
EXAMPLE_DOT_COM
|
static byte[] |
MAGIC_GIF_87a
|
static byte[] |
MAGIC_GIF_89a
|
static byte[] |
MAGIC_JPEG
|
static byte[] |
MAGIC_PNG
|
static java.lang.String |
SendMailArgs_className
|
static java.lang.String |
THREAD_CURRENT
|
static java.lang.String |
THREAD_DEBUG
|
static java.lang.String |
THREAD_NEW
|
static java.lang.String |
THREAD_NONE
|
static java.lang.String |
THREAD_POOL
|
static java.lang.String |
X_AlarmRule
|
static java.lang.String |
X_AssetId
|
static java.lang.String |
X_EventTime
|
static java.lang.String |
X_GPSLocation
|
static java.lang.String |
X_OriginatingIP
|
static java.lang.String |
X_OwnerId
|
static java.lang.String |
X_PageType
|
static java.lang.String |
X_Requestor
|
static java.lang.String |
X_StatusCode
|
Constructor Summary | |
---|---|
SendMail()
|
Method Summary | |
---|---|
static java.lang.String |
DefaultContentType(byte[] data)
Returns the MIME contents type for the specified file contents |
static java.lang.String |
getDefaultUserEmail(java.lang.String mainEmail)
Returns the specified override "From" email address, if non-blank, otherwise the default configured "From" email address will be returned. |
static java.lang.String |
getEMailAddress(java.lang.String addr)
Filters and returns the base email address from the specified String. For example, if the String "Jones<jones@example.com>" is passed to this method, then the value "jones@example.com" will be returned. |
static boolean |
GetShowThreadModel()
Sets the SendMail thread-model 'show' state (during debug mode) |
static boolean |
IsBlankEmailAddress(java.lang.String email)
|
static boolean |
IsSendMailEnabled()
Returns true if "SendMail" is enabled |
static void |
main(java.lang.String[] argv)
Command-line debug/testing entry point |
static boolean |
SaveToOutbox(SendMail.Args args)
Save specified SendMail Args to outbox |
static boolean |
send(java.util.Properties headers,
java.lang.String from,
java.lang.String[] to,
java.lang.String[] cc,
java.lang.String[] bcc,
java.lang.String subject,
java.lang.String msgBody,
SendMail.Attachment attach,
SendMail.SmtpProperties smtpProps,
boolean queRetry)
Sends an email |
static boolean |
send(java.lang.String from,
java.lang.String to,
java.lang.String subject,
java.lang.String msgBody,
SendMail.Attachment attach,
SendMail.SmtpProperties smtpProps)
Sends an email |
static boolean |
send(java.lang.String from,
java.lang.String to,
java.lang.String subject,
java.lang.String msgBody,
SendMail.Attachment attach,
SendMail.SmtpProperties smtpProps,
boolean queRetry)
Sends an email |
static boolean |
send(java.lang.String from,
java.lang.String to,
java.lang.String subject,
java.lang.String msgBody,
SendMail.SmtpProperties smtpProps)
Sends an email |
static boolean |
send(java.lang.String from,
java.lang.String to,
java.lang.String subject,
java.lang.String msgBody,
SendMail.SmtpProperties smtpProps,
boolean queRetry)
Sends an email |
static boolean |
send(java.lang.String from,
java.lang.String to,
java.lang.String cc,
java.lang.String bcc,
java.lang.String subject,
java.lang.String msgBody,
SendMail.Attachment attach,
SendMail.SmtpProperties smtpProps)
Sends an email |
static boolean |
send(java.lang.String from,
java.lang.String to,
java.lang.String cc,
java.lang.String bcc,
java.lang.String subject,
java.lang.String msgBody,
SendMail.Attachment attach,
SendMail.SmtpProperties smtpProps,
boolean queRetry)
Sends an email |
static boolean |
sendSysadmin(java.lang.String subject,
java.lang.String msgBody)
Sends a system notification email to the defined system admin email address |
static void |
SetShowThreadModel(boolean show)
Returns true if the SendMail thread-model should be displayed when in debug mode. |
static void |
SetSleepAfterEMailMS(long sleepMS)
Sets the amount of time to sleep after sending an email. Note: this must be used with caution, since it could cause a significant backlog if many emails are sent to the threadpool. |
static void |
SetThreadModel(java.lang.String model)
Sets the 'thread model' for email sent by this class. The valid values are THREAD_CURRENT, THREAD_POOL, THREAD_NEW, or THREAD_DEBUG. |
static void |
SetThreadModel(java.lang.String model,
boolean show)
Sets the 'thread model' for email sent by this class. The valid values are THREAD_CURRENT, THREAD_POOL, THREAD_NEW, or THREAD_DEBUG. |
static boolean |
validateAddress(java.lang.String addr)
Validate the specified email address. |
static boolean |
validateAddresses(java.lang.String addr)
Validate the specified list of comma-separated email addresses. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String SendMailArgs_className
public static final java.lang.String EXAMPLE_DOT_COM
public static final java.lang.String X_OwnerId
public static final java.lang.String X_AssetId
public static final java.lang.String X_PageType
public static final java.lang.String X_Requestor
public static final java.lang.String X_OriginatingIP
public static final java.lang.String X_EventTime
public static final java.lang.String X_StatusCode
public static final java.lang.String X_AlarmRule
public static final java.lang.String X_GPSLocation
public static final byte[] MAGIC_GIF_87a
public static final byte[] MAGIC_GIF_89a
public static final byte[] MAGIC_JPEG
public static final byte[] MAGIC_PNG
public static final java.lang.String THREAD_NONE
public static final int _THREAD_NONE
public static final java.lang.String THREAD_CURRENT
public static final int _THREAD_CURRENT
public static final java.lang.String THREAD_POOL
public static final int _THREAD_POOL
public static final java.lang.String THREAD_NEW
public static final int _THREAD_NEW
public static final java.lang.String THREAD_DEBUG
public static final int _THREAD_DEBUG
Constructor Detail |
---|
public SendMail()
Method Detail |
---|
public static void SetSleepAfterEMailMS(long sleepMS)
public static boolean IsSendMailEnabled()
public static boolean IsBlankEmailAddress(java.lang.String email)
public static boolean SaveToOutbox(SendMail.Args args)
public static void SetShowThreadModel(boolean show)
public static boolean GetShowThreadModel()
public static void SetThreadModel(java.lang.String model)
model
- The specified thread model.public static void SetThreadModel(java.lang.String model, boolean show)
model
- The specified thread model.show
- True to display the thread model when sending an email (debug purposes only).public static java.lang.String getDefaultUserEmail(java.lang.String mainEmail)
mainEmail
- The overriding email address to return if non-blank
public static boolean sendSysadmin(java.lang.String subject, java.lang.String msgBody)
subject
- The email subjectmsgBody
- The email message body
public static boolean send(java.lang.String from, java.lang.String to, java.lang.String subject, java.lang.String msgBody, SendMail.SmtpProperties smtpProps)
from
- The sender of the emailto
- A comma-separated list of email recipients.subject
- The email subject.msgBody
- The email message body.smtpProps
- The custom SMTP properties
public static boolean send(java.lang.String from, java.lang.String to, java.lang.String subject, java.lang.String msgBody, SendMail.SmtpProperties smtpProps, boolean queRetry)
from
- The sender of the emailto
- A comma-separated list of email recipients.subject
- The email subject.msgBody
- The email message body.smtpProps
- The custom SMTP propertiesqueRetry
- True to queue to outbox on connection/auth failure.
public static boolean send(java.lang.String from, java.lang.String to, java.lang.String subject, java.lang.String msgBody, SendMail.Attachment attach, SendMail.SmtpProperties smtpProps)
from
- The sender of the emailto
- A comma-separated list of email recipients.subject
- The email subject.msgBody
- The email message body.attach
- An email attachmentsmtpProps
- The custom SMTP properties
public static boolean send(java.lang.String from, java.lang.String to, java.lang.String subject, java.lang.String msgBody, SendMail.Attachment attach, SendMail.SmtpProperties smtpProps, boolean queRetry)
from
- The sender of the emailto
- A comma-separated list of email recipients.subject
- The email subject.msgBody
- The email message body.attach
- An email attachmentsmtpProps
- The custom SMTP propertiesqueRetry
- True to queue to outbox on connection/auth failure.
public static boolean send(java.lang.String from, java.lang.String to, java.lang.String cc, java.lang.String bcc, java.lang.String subject, java.lang.String msgBody, SendMail.Attachment attach, SendMail.SmtpProperties smtpProps)
from
- The sender of the emailto
- A comma-separated list of 'To:' email recipients.cc
- A comma-separated list of 'Cc:' email recipients.bcc
- A comma-separated list of 'Bcc:' email recipients.subject
- The email subject.msgBody
- The email message body.attach
- An email attachmentsmtpProps
- The custom SMTP properties
public static boolean send(java.lang.String from, java.lang.String to, java.lang.String cc, java.lang.String bcc, java.lang.String subject, java.lang.String msgBody, SendMail.Attachment attach, SendMail.SmtpProperties smtpProps, boolean queRetry)
from
- The sender of the emailto
- A comma-separated list of 'To:' email recipients.cc
- A comma-separated list of 'Cc:' email recipients.bcc
- A comma-separated list of 'Bcc:' email recipients.subject
- The email subject.msgBody
- The email message body.attach
- An email attachmentsmtpProps
- The custom SMTP propertiesqueRetry
- True to queue to outbox on connection/auth failure.
public static boolean send(java.util.Properties headers, java.lang.String from, java.lang.String[] to, java.lang.String[] cc, java.lang.String[] bcc, java.lang.String subject, java.lang.String msgBody, SendMail.Attachment attach, SendMail.SmtpProperties smtpProps, boolean queRetry)
from
- The sender of the emailto
- An array of 'To:' email recipients.cc
- An array of 'Cc:' email recipients.bcc
- An array of 'Bcc:' email recipients.subject
- The email subject.msgBody
- The email message body.attach
- An email attachmentsmtpProps
- The custom SMTP propertiesqueRetry
- An email attachment
public static java.lang.String DefaultContentType(byte[] data)
data
- The file contents
public static boolean validateAddresses(java.lang.String addr)
addr
- A comma-separated list of email addresses
public static boolean validateAddress(java.lang.String addr)
addr
- The email address to validate.
public static java.lang.String getEMailAddress(java.lang.String addr)
addr
- The email address to filter.
public static void main(java.lang.String[] argv)
argv
- The command-line arguments
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |