本文整理匯總了Java中javax.mail.internet.InternetAddress.validate方法的典型用法代碼示例。如果您正苦於以下問題:Java InternetAddress.validate方法的具體用法?Java InternetAddress.validate怎麽用?Java InternetAddress.validate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.mail.internet.InternetAddress
的用法示例。
在下文中一共展示了InternetAddress.validate方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: validateEmailStandard
import javax.mail.internet.InternetAddress; //導入方法依賴的package包/類
public static String validateEmailStandard(String email){
try{
InternetAddress testEmail = new InternetAddress(email);
testEmail.validate();
return email + " is a valid email address";
}catch(AddressException e){
return email + " is not a valid email address";
}
}
開發者ID:PacktPublishing,項目名稱:Machine-Learning-End-to-Endguide-for-Java-developers,代碼行數:10,代碼來源:ValidatingData.java
示例2: isValidEmailAddress
import javax.mail.internet.InternetAddress; //導入方法依賴的package包/類
/**
* @param email
* @return true si l'adrese est correcte
*/
public static boolean isValidEmailAddress(String email) {
boolean result = true;
try {
InternetAddress emailAddr = new InternetAddress(email);
emailAddr.validate();
} catch (AddressException ex) {
result = false;
}
return result;
}
示例3: isValidEmailAddress
import javax.mail.internet.InternetAddress; //導入方法依賴的package包/類
/**
* Is valid email address boolean.
*
* @param email the email
* @return the boolean
*/
public static boolean isValidEmailAddress(final String email) {
boolean result = true;
try {
InternetAddress emailAddr = new InternetAddress(email);
emailAddr.validate();
} catch (AddressException ex) {
result = false;
}
return result;
}
示例4: isValidEmailAddress
import javax.mail.internet.InternetAddress; //導入方法依賴的package包/類
public static boolean isValidEmailAddress(String email) {
boolean valid = true;
try {
InternetAddress emailAddr = new InternetAddress(email);
emailAddr.validate();
} catch (AddressException ex) {
valid = false;
}
return valid;
}
示例5: isValidEmailAddress
import javax.mail.internet.InternetAddress; //導入方法依賴的package包/類
public static boolean isValidEmailAddress(String email) {
boolean result = true;
try {
InternetAddress emailAddr = new InternetAddress(email);
emailAddr.validate();
} catch (AddressException ex) {
result = false;
}
return result;
}
示例6: isValidEmailAddress
import javax.mail.internet.InternetAddress; //導入方法依賴的package包/類
public static boolean isValidEmailAddress(String email) {
boolean result = true;
try {
InternetAddress emailAddr = new InternetAddress(email);
emailAddr.validate();
} catch (AddressException ex) {
result = false;
}
return result;
}
示例7: isEmail
import javax.mail.internet.InternetAddress; //導入方法依賴的package包/類
public static boolean isEmail(String email) {
try {
// Create InternetAddress object and validated the email address.
InternetAddress internetAddress = new InternetAddress(email);
internetAddress.validate();
} catch (Exception e) {
return false;
}
return true;
}
示例8: validateAddress
import javax.mail.internet.InternetAddress; //導入方法依賴的package包/類
/**
* Validate the given mail address.
* Called by all of MimeMessageHelper's address setters and adders.
* <p>Default implementation invokes {@code InternetAddress.validate()},
* provided that address validation is activated for the helper instance.
* <p>Note that this method will just work on JavaMail >= 1.3. You can override
* it for validation on older JavaMail versions or for custom validation.
* @param address the address to validate
* @throws AddressException if validation failed
* @see #isValidateAddresses()
* @see javax.mail.internet.InternetAddress#validate()
*/
protected void validateAddress(InternetAddress address) throws AddressException {
if (isValidateAddresses()) {
address.validate();
}
}