tot.util
类 EmailUtil

java.lang.Object
  继承者 tot.util.EmailUtil

public class EmailUtil
extends java.lang.Object


字段摘要
static int MAX_MESSAGES_PER_TRANSPORT
           
 
构造函数摘要
EmailUtil()
          Creates a new instance of EmailUtil
 
方法摘要
static void checkGoodEmail(java.lang.String input)
          Check if an email is good and safe or not.
static java.lang.String getEmailDomain(java.lang.String email)
          Get the domain part of an email.
static java.lang.String[] getEmails(java.lang.String email)
          This method trim the email variable, so if it contains only spaces, then it will be empty string, then we have 0 token :-) The returned value is never null
static java.lang.String getEmailUsername(java.lang.String email)
          Get the user name part of an email.
static java.lang.String send(java.lang.String to, java.lang.String cc, java.lang.String bcc, java.lang.String subject, java.lang.String message)
           
static java.lang.String sendHtml(java.lang.String to, java.lang.String cc, java.lang.String bcc, java.lang.String subject, java.lang.String message)
           
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

MAX_MESSAGES_PER_TRANSPORT

public static final int MAX_MESSAGES_PER_TRANSPORT
另请参见:
常量字段值
构造函数详细信息

EmailUtil

public EmailUtil()
Creates a new instance of EmailUtil

方法详细信息

getEmailUsername

public static java.lang.String getEmailUsername(java.lang.String email)
Get the user name part of an email. Ex: input: test@yahoo.com => output: test

参数:
email - String the email
返回:
String the user name part of an email

getEmailDomain

public static java.lang.String getEmailDomain(java.lang.String email)
Get the domain part of an email. Ex: input: test@yahoo.com => output: yahoo.com

参数:
email - String the email
返回:
String the user name part of an email

checkGoodEmail

public static void checkGoodEmail(java.lang.String input)
                           throws BadInputException
Check if an email is good and safe or not. This method should be use for all email input from user

参数:
input - String
抛出:
BadInputException - if email is not good

getEmails

public static java.lang.String[] getEmails(java.lang.String email)
                                    throws BadInputException
This method trim the email variable, so if it contains only spaces, then it will be empty string, then we have 0 token :-) The returned value is never null

抛出:
BadInputException

send

public static java.lang.String send(java.lang.String to,
                                    java.lang.String cc,
                                    java.lang.String bcc,
                                    java.lang.String subject,
                                    java.lang.String message)
                             throws org.apache.commons.mail.EmailException,
                                    java.io.IOException
抛出:
org.apache.commons.mail.EmailException
java.io.IOException

sendHtml

public static java.lang.String sendHtml(java.lang.String to,
                                        java.lang.String cc,
                                        java.lang.String bcc,
                                        java.lang.String subject,
                                        java.lang.String message)
                                 throws org.apache.commons.mail.EmailException,
                                        java.io.IOException
抛出:
org.apache.commons.mail.EmailException
java.io.IOException