本文整理汇总了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();
}
}