1234567891011121314151617181920212223242526272829 |
- package com.rf.AIquantum.utils;
- import lombok.extern.slf4j.Slf4j;
- import org.apache.commons.net.smtp.SMTPClient;
- import org.apache.commons.net.smtp.SMTPReply;
- import org.xbill.DNS.Lookup;
- import org.xbill.DNS.Record;
- import org.xbill.DNS.Type;
- import java.io.IOException;
- import java.util.regex.Matcher;
- import java.util.regex.Pattern;
- @Slf4j
- public class EmailUtil {
- private static final String EMAIL_REGEX = "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$";
- public static boolean checkEmail(String email) {
- if (email == null || email.isEmpty()) {
- return false;
- }
- Pattern pattern = Pattern.compile(EMAIL_REGEX);
- Matcher matcher = pattern.matcher(email);
- return matcher.matches();
- }
- }
|