public final class EmailUtil
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
EmailUtil.ConnectionSecurity |
| Modifier and Type | Field and Description |
|---|---|
static java.lang.ThreadLocal<java.lang.Boolean> |
DISABLE_MX_LOOPUP |
| Constructor and Description |
|---|
EmailUtil() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
checkLinks(java.lang.String htmlBody)
validate if the url in html email body is on localhost
|
static java.lang.String |
checkMX(java.lang.String hostName,
java.util.Map<java.lang.String,java.lang.Object> hostCache)
check the MX record
|
static java.lang.String[] |
lookupMailHosts(java.lang.String domainName)
returns a String array of mail exchange servers (mail hosts) sorted from most preferred to least preferred
see: RFC 974 - Mail routing and the domain system
see: RFC 1034 - Domain names - concepts and facilities
see: http://java.sun.com/j2se/1.5.0/docs/guide/jndi/jndi-dns.html
- DNS Service Provider for the Java Naming Directory Interface (JNDI)
|
static Session |
makeSessionSMTP() |
static Session |
makeSessionSMTP(java.lang.String host,
int port,
java.lang.String username,
java.lang.String password,
EmailUtil.ConnectionSecurity security) |
static void |
validate(java.lang.String email,
java.util.Map<java.lang.String,java.lang.Object> hostCache)
Validate an email address.
|
static void |
validateSMTP(java.lang.String host,
int port,
java.lang.String username,
java.lang.String password,
EmailUtil.ConnectionSecurity security) |
public static final java.lang.ThreadLocal<java.lang.Boolean> DISABLE_MX_LOOPUP
public static Session makeSessionSMTP()
throws InvalidDataException
InvalidDataException@Nonnull
@CheckReturnValue
public static Session makeSessionSMTP(java.lang.String host,
int port,
java.lang.String username,
java.lang.String password,
EmailUtil.ConnectionSecurity security)
throws InvalidDataException
InvalidDataException@CheckReturnValue
@Nullable
public static java.lang.String checkLinks(@Nonnull
java.lang.String htmlBody)
htmlBody - email html bodypublic static void validateSMTP(java.lang.String host,
int port,
java.lang.String username,
java.lang.String password,
EmailUtil.ConnectionSecurity security)
throws AuthenticationFailedException,
MessagingException
AuthenticationFailedExceptionMessagingExceptionpublic static void validate(@Nonnull
java.lang.String email,
@Nullable
java.util.Map<java.lang.String,java.lang.Object> hostCache)
throws InvalidDataException
email - the email to validate.hostCache - OPTIONAL cache of host namesInvalidDataException - details of the issue found.
http://en.wikipedia.org/wiki/E-mail_address#Local_part@Nonnull
@CheckReturnValue
public static java.lang.String[] lookupMailHosts(@Nonnull
java.lang.String domainName)
throws javax.naming.NamingException
domainName - the domain to checkjavax.naming.NamingException@CheckReturnValue
@Nullable
public static java.lang.String checkMX(@Nonnull
java.lang.String hostName,
@Nullable
java.util.Map<java.lang.String,java.lang.Object> hostCache)
hostName - host to checkhostCache - OPTIONAL cache of host namesstSoftware Copyright © 2001-2014 stSoftware All Rights Reserved.