邮箱格式

来源:互联网 发布:淘宝淘口令在线生成 编辑:程序博客网 时间:2024/04/29 18:52
// 验证邮箱的格式
public boolean isEmail(String email) {
final String check = "^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$";
final Pattern regex = Pattern.compile(check);
final Matcher matcher = regex.matcher(email);
return matcher.matches();

}


基础流,高级流,文件操作用得比较多的是:RandomAccessFile记录数值的游标,偏移量


初始化异常可能是因为你加入的包起冲突了。

try{
HtmlEmail email = new HtmlEmail();
email.setHostName("smtp.com");
email.setAuthentication(commonEmail, commonEmailPwd);
email.setCharset("UTF-8");
if(null == toMails || "".equals(toMails)){
return Boolean.FALSE;
}
for(String mail:toMails.split(",")){
email.addTo(mail);
}
email.setFrom(commonFromMailAddress,"csdn"); 
email.setSmtpPort(25);
email.setSubject(title);
// email.setHtmlMsg(content);
email.setContent(content, "text/html");
if(log.isInfoEnabled()){
log.info("=================send email by java mail:");
log.info("=================title is :" + title);
// log.info("=================content is :" + content);
log.info("=================send to :" + toMails);
}
email.send();
}catch(Exception e){
Profiler.functionError(info);
log.error("send email by javamail error tomailaddress["+toMails+"]!",e);
e.printStackTrace();
return false;
}finally{
Profiler.registerInfoEnd(info);
}

同一ip两分钟 只能发送10次
同一邮箱4小时只能发送10次




0 0
原创粉丝点击