
Classes | |
| interface | Delegate |
Public Member Functions | |
| String | adminEmail () |
| NSArray< String > | blackListEmailAddressPatterns () |
| EOOrQualifier | blackListQualifier () |
| boolean | centralize () |
| boolean | debugEnabled () |
| javax.mail.Session | defaultSession () |
| String | defaultXMailerHeader () |
| NSArray< String > | filterEmailAddresses (NSArray< String > emailAddresses) |
| void | finishInitialization () |
| boolean | hasBlackList () |
| boolean | hasWhiteList () |
| void | initializeFrameworkFromSystemProperties () |
| synchronized boolean | isValidEmail (String email) |
| int | milliSecondsWaitIfSenderOverflowed () |
| javax.mail.Session | newSession () |
| javax.mail.Session | newSession (Properties props) |
| javax.mail.Session | newSessionForContext (Properties properties, String contextString) |
| javax.mail.Session | newSessionForMessage (ERMessage message) |
| int | senderQueueSize () |
| javax.mail.Session | sessionForMessage (ERMessage message) |
| void | setAdminEmail (String adminEmail) |
| void | setCentralize (boolean centralize) |
| void | setDebugEnabled (boolean debug) |
| void | setDefaultSession (javax.mail.Session session) |
| void | setDefaultXMailerHeader (String header) |
| void | setDelegate (Delegate delegate) |
| void | setMilliSecondsWaitIfSenderOverflowed (int value) |
| void | setSenderQueueSize (int value) |
| String | smtpProtocolForContext (String contextString) |
| String | validateEmail (EOEnterpriseObject object, String key, String email) |
| NSArray< String > | whiteListEmailAddressPatterns () |
| EOOrQualifier | whiteListQualifier () |
Static Public Member Functions | |
| static ERJavaMail | sharedInstance () |
Static Public Attributes | |
| static final Class<?> | REQUIRES [] = new Class[] { ERXExtensions.class } |
Protected Member Functions | |
| javax.mail.Session | newSessionForContext (String contextString) |
| EOOrQualifier | qualifierArrayForEmailPatterns (NSArray< String > emailPatterns) |
| javax.mail.Session | sessionForContext (String contextString) |
| void | setupSmtpHostSafely () |
| void | setupSmtpProperties (Properties properties, String contextString) |
Protected Attributes | |
| String | _adminEmail |
| boolean | _centralize = true |
| boolean | _debugEnabled = true |
| javax.mail.Session | _defaultSession |
| String | _defaultXMailerHeader = null |
| int | _milliSecondsWaitIfSenderOverflowed = 6000 |
| Pattern | _pattern = null |
| int | _senderQueueSize = 50 |
| EOOrQualifier | blackListQualifier |
| NSArray< String > | blakListEmailAddressPatterns |
| NSArray< String > | whiteListEmailAddressPatterns |
| EOOrQualifier | whiteListQualifier |
Static Protected Attributes | |
| static ERJavaMail | sharedInstance |
Static Package Functions | |
| [static initializer] | |
Private Attributes | |
| Delegate | _delegate |
| Map< String, javax.mail.Session > | _sessions = new ConcurrentHashMap<String, javax.mail.Session>() |
Static Private Attributes | |
| static final String | atext = "[a-zA-Z0-9" + sp + "]" |
| static final String | atom = atext + "+" |
| static final String | domain = rfcLabel + "((\\." + rfcLabel + ")*\\." + letter + "{2,6}){0,1}" |
| static final String | dotAtom = "\\." + atom |
| static final String | EMAIL_VALIDATION_PATTERN = "^" + localPart + "@" + domain + "$" |
| static final String | letDig = "[a-zA-Z0-9]" |
| static final String | letDigHyp = "[a-zA-Z0-9\\-]" |
| static final String | letter = "[a-zA-Z]" |
| static final String | localPart = atom + "(" + dotAtom + ")*" |
| static final Logger | log = Logger.getLogger(ERJavaMail.class) |
| static final String | rfcLabel = letDig + "(" + letDigHyp + "{0,61}" + letDig + "){0,1}" |
| static final String | sp = "!#$%&'*+\\-/=?^_`{|}~" |
| [static initializer] | ( | ) | [static, package] |
| String adminEmail | ( | ) |
admin email accessor. The admin email is the email address where centralized mail go to.
String value | NSArray<String> blackListEmailAddressPatterns | ( | ) |
Gets the array of black list email address patterns.
| EOOrQualifier blackListQualifier | ( | ) |
Gets the Or qualifier to match any of the patterns in the black list.
| boolean centralize | ( | ) |
Centralize is used to send all the outbound email to a single address which is useful when debugging.
boolean value | boolean debugEnabled | ( | ) |
Returns true if JavaMail is debug enabled.
boolean value | javax.mail.Session defaultSession | ( | ) |
This is the deafult JavaMail Session accessor. It is shared among all deliverers for immediate deliveries. Deferred deliverers, use their own JavaMail session.
javax.mail.Session instance | String defaultXMailerHeader | ( | ) |
Gets the default X-Mailer header to use for sending mails. Pulls the value out of the property: er.javamail.XMailerHeader
Filters an array of email addresses by the black and white lists.
| emailAddresses | array of email addresses to be filtered |
| void finishInitialization | ( | ) | [virtual] |
Specialized implementation of the method from ERXPrincipalClass.
Implements ERXFrameworkPrincipal.
| boolean hasBlackList | ( | ) |
Determines if a black list has been specified
| boolean hasWhiteList | ( | ) |
Determines if a white list has been specified
| void initializeFrameworkFromSystemProperties | ( | ) |
This method is used to initialize ERJavaMail from System properties. Later, we will implement a way to initialize those properties everytime the propertis are changed. The observer will call this method whenever appropriate.
| synchronized boolean isValidEmail | ( | String | ) |
Predicate used to validate email well-formness.
| the email String value to validate |
boolean value | int milliSecondsWaitIfSenderOverflowed | ( | ) |
This method return the time spent waiting if the mail queue if overflowed. During that time, mails are sent and the queue lowers. When the duration is spent, and the queue is under the overflow limit, the mails are being sent again.
int value | javax.mail.Session newSession | ( | ) |
Returns a newly allocated Session object from the System Properties
javax.mail.Session value | javax.mail.Session newSession | ( | Properties | props | ) |
Returns a newly allocated Session object from the given Properties
| props | a Properties value |
javax.mail.Session value initialized from the given properties | javax.mail.Session newSessionForContext | ( | Properties | properties, | |
| String | contextString | |||
| ) |
Returns a newly allocated Session object from the given Properties
| properties | a Properties value |
javax.mail.Session value initialized from the given properties | javax.mail.Session newSessionForContext | ( | String | contextString | ) | [protected] |
Returns a new Session object that is appropriate for the given context.
| contextString | the message context |
javax.mail.Session value | javax.mail.Session newSessionForMessage | ( | ERMessage | message | ) |
Returns a newly allocated Session object for the given message.
| message | the message |
javax.mail.Session value | EOOrQualifier qualifierArrayForEmailPatterns | ( | NSArray< String > | emailPatterns | ) | [protected] |
Constructs an Or qualifier for filtering an array of strings that might have the * wildcard character. Will be nice when we have regex in Java 1.4.
| emailPatterns | array of email patterns |
| int senderQueueSize | ( | ) |
| javax.mail.Session sessionForContext | ( | String | contextString | ) | [protected] |
Returns the Session object that is appropriate for the given context.
| contextString | the message context |
javax.mail.Session value | javax.mail.Session sessionForMessage | ( | ERMessage | message | ) |
Returns the Session object that is appropriate for the given message.
javax.mail.Session value | void setAdminEmail | ( | String | adminEmail | ) |
Sets the admin email to another value. This value is set at initialization from the er.javamail.adminEmail Property.
| adminEmail | a String value |
| void setCentralize | ( | boolean | centralize | ) |
Sets the value of the er.javamail.centralize Property.
| centralize | if the boolean value is true, then all the outbound mails will be sent to adminEmail email address. |
| void setDebugEnabled | ( | boolean | debug | ) |
Sets the debug mode of JavaMail.
| debug | a boolean value sets JavaMail in debug mode |
| void setDefaultSession | ( | javax.mail.Session | session | ) |
Sets the default JavaMail session to a particular value. This value is set by default at initialization of the framework but you can specify a custom one by using this method. Note that a new deliverer need to be instanciated for changes to be taken in account.
| session | the default javax.mail.Session |
| void setDefaultXMailerHeader | ( | String | header | ) |
Sets the default value of the XMailer header used when sending mails.
| header | a String value |
| void setDelegate | ( | Delegate | delegate | ) |
| void setMilliSecondsWaitIfSenderOverflowed | ( | int | value | ) |
Sets the value of the er.javamail.milliSecondsWaitIfSenderOverflowed Property.
| value | an int value in milli-seconds. |
| void setSenderQueueSize | ( | int | value | ) |
| void setupSmtpHostSafely | ( | ) | [protected] |
Helper method to init the smtpHost property. This method first check is er.javamail.smtpHost is set. If it is not set, then it looks for mail.smtp.host (standard JavaMail property) and finally the WOSMTPHost property. When a correct property is found, then it sets both properties to the found value. If no properties are found, a RuntimeException is thrown.
| RuntimeException | if neither one of er.javamail.smtpHost, mail.smtp.host or WOSMTPHost is set. |
| void setupSmtpProperties | ( | Properties | properties, | |
| String | contextString | |||
| ) | [protected] |
| static ERJavaMail sharedInstance | ( | ) | [static] |
Returns the SMTP protocol to use for connections.
Validates an enterprise object's email attribute (accessed via key).
| object | the object to be validated | |
| key | the attribute's name | |
| the email value |
| NSArray<String> whiteListEmailAddressPatterns | ( | ) |
Gets the array of white list email address patterns.
| EOOrQualifier whiteListQualifier | ( | ) |
Whilte list Or qualifier to match any of the patterns in the white list.
String _adminEmail [protected] |
email address used when centralizeMails == true
Needed when debugging application so that mails are always sent to only one destination.
boolean _centralize = true [protected] |
Used to send mail to adminEmail only. Useful for debugging issues
boolean _debugEnabled = true [protected] |
This property specify wether JavaMail is debug enabled or not.
javax.mail.Session _defaultSession [protected] |
This is the default JavaMail Session. It is shared among all deliverers for immediate deliveries. Deferred deliverers, use their own JavaMail session.
String _defaultXMailerHeader = null [protected] |
This property sets the default header for the X-Mailer property
int _milliSecondsWaitIfSenderOverflowed = 6000 [protected] |
Wait n milliseconds (by default this value is 6000) if the mail sender is overflowed
int _senderQueueSize = 50 [protected] |
Number of messages that the sender queue can hold at a time; default to 50 messages and can be configured by er.javamail.senderQueue.size system property.
Map<String, javax.mail.Session> _sessions = new ConcurrentHashMap<String, javax.mail.Session>() [private] |
EOOrQualifier blackListQualifier [protected] |
holds the black list qualifier
NSArray<String> blakListEmailAddressPatterns [protected] |
holds the array of black list email addresses
final String domain = rfcLabel + "((\\." + rfcLabel + ")*\\." + letter + "{2,6}){0,1}" [static, private] |
final String EMAIL_VALIDATION_PATTERN = "^" + localPart + "@" + domain + "$" [static, private] |
final Logger log = Logger.getLogger(ERJavaMail.class) [static, private] |
Class logger
Reimplemented from ERXFrameworkPrincipal.
final Class<?> REQUIRES[] = new Class[] { ERXExtensions.class } [static] |
ERJavaMail sharedInstance [static, protected] |
ERJavaMail class singleton.
EMAIL_VALIDATION_PATTERN is a regexp pattern that is used to validate emails.
NSArray<String> whiteListEmailAddressPatterns [protected] |
holds the array of white list email addresses
EOOrQualifier whiteListQualifier [protected] |
holds the white list qualifier
1.5.8