- 浏览: 66404 次
- 性别:
- 来自: 上海
文章分类
最新评论
最近公司需要写一个通用一点的邮件发送功能,暂时主要是完成通用的验证后给顾客发送一个连接之类的纯文本消息,所以自己在java官网巴拉巴拉看了一通,瞎整了一个简单的java邮件发送功能,进过验证,功能简单但是效果还行,通过qq,163,outlook等邮箱服务器互发都ok,主要是,可以一对多发送。jar包就是很简单的javax.mail.jar
package javamail;
import java.util.Date;
import java.util.Properties;
import javax.mail.Address;
import javax.mail.AuthenticationFailedException;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.NoSuchProviderException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import com.sun.mail.util.MailConnectException;
public class SendMailImpl implements SendMail{
public SendMailResult sendMail(String host,int port,String username,
String password,String subject,String contentType,
Date date,String header,Object contents,Address from,InternetAddress[] toUsers){
SendMailResult result = new SendMailResult();
if(isValidInput(result, host, username, port,from,toUsers))
{
Properties prop = mailConfig(true,true,host,username,port);
Session session = Session.getInstance(prop); //根据prop配置创建一个新的session对象
try {
Transport transport = session.getTransport();
transport.connect(host,port,username,password); //建立和邮箱服务器的链接
MimeMessage message = createMessage(session, from, toUsers, header, subject, contents, contentType, date);
transport.sendMessage(message,toUsers); //发送邮件
transport.close();
} catch (NoSuchProviderException e) {
result.setReturnCode(7);
// e.printStackTrace();
return result;
}catch (MessagingException e) {
System.out.println("host:"+host+" port:" +port+" username:"+username+" password:"+password);
if(e instanceof MailConnectException){
result.setReturnCode(6);
}else if(e instanceof AuthenticationFailedException){
result.setReturnCode(8);
}
else
result.setReturnCode(7);
// e.printStackTrace();
return result;
}
return result;
}else{
return result;
}
}
/**
* toUsers 必须是逗号隔开的String字符串
* @param toUsers
* @param date
* @param header
* @param subject
* @param contents
* @return
*/
public SendMailResult sendMailWithDefaultSetting(String toUsers,Date date,String header,String subject,String contents)
{
SendMailResult result =new SendMailResult();
if(toUsers!=null && toUsers.length()>0)
{
try{
InternetAddress[] to=InternetAddress.parse(toUsers);
result = sendMail(SendMail.HOST, SendMail.PORT, SendMail.SYSTEM_USER,SendMail.SYSTEM_USER_PASSWORD,
subject, SendMail.CONTENT_TYPE,date, header, contents, new InternetAddress(SendMail.SYSTEM_USER_ADDRESS),to);
}catch(AddressException e){
result.setReturnCode(5);
}
}
return result;
}
/**
* 邮箱发送方初始配置信息
* @param isDebug
* @param isStrict
* @param hostAddress
* @param username
* @param port
* @return
*/
private Properties mailConfig(boolean isDebug,boolean isStrict,String hostAddress,String username,int port){
Properties prop = new Properties();
String debug = (isDebug)?"true":"false";
String strict = (isStrict)?"true":"false";
hostAddress=(hostAddress==null)? SendMail.HOST : hostAddress;
String protocol=SendMail.DEFAULT_PROTOCOL; //设置发送邮件协议为smtp
port=(port<=0)? SendMail.PORT : port;
username=(hostAddress==null)? SendMail.SYSTEM_USER:username;
prop.setProperty("mail.debug",debug); //是否开启调试
prop.setProperty("mail.mime.address.strict", strict); //邮箱地址是否严格检查
prop.setProperty("mail.protocol.host", hostAddress); //设置邮箱发送服务器地址
prop.setProperty("mail.transport.protocol", protocol); //设置邮箱服务器发送协议smtp
prop.setProperty("mail.protocol.user", username); //设置发送方
prop.setProperty("mail.protocol.port", String.valueOf(port)); //设置邮箱服务器发送端口
return prop;
}
/**
* 构成邮件体的通用方法
* @param session
* @param from
* @param toUsers
* @param header
* @param subject
* @param contents
* @param contentType
* @param sendDate
* @return
*/
private MimeMessage createMessage(Session session,Address from,InternetAddress[] toUsers,String header,String subject,Object contents,String contentType,Date sendDate){
MimeMessage message = new MimeMessage(session); //创建发送邮件体
try {
message.addFrom(new Address[]{from});
message.addHeader(header, header);
message.addRecipients(Message.RecipientType.TO, toUsers);
message.setSubject(subject);
message.setContent(contents, contentType);
if(sendDate.before(new Date())) //如果发送时间为小于当前时间,设为立即时间发送
sendDate = new Date();
message.setSentDate(sendDate); //设定发送时间
} catch (MessagingException e) {
e.printStackTrace();
}
return message;
}
private boolean isValidInput(SendMailResult result,String host,String username,int port,Address from,Address[] to){
if(host==null||host.equals("")){
result.setReturnCode(1);
result.setReturnMessage("server adress missing !");
return false;
}else if(username==null||username.equals(""))
{
result.setReturnCode(2);
return false;
}else if(port<=0)
{
result.setReturnCode(3);
return false;
}else if(from==null){
result.setReturnCode(4);
return false;
}else if(to==null||to.length<1){
result.setReturnCode(5);
return false;
}
return true;
}
public static void main(String[] args) throws Exception {
SendMailResult result = new SendMailImpl().sendMail("mail.xx.com",25, "username","password","java mail test!","text/plain; charset=utf-8",
new Date(),"java mail test!","http://www.baidu.com",new InternetAddress("xx@xx.com"),new InternetAddress[]{new InternetAddress("xx@xx.com"),new InternetAddress("xx@xx.com")});
System.out.println(result);
Thread.sleep(1000);
result = new SendMailImpl().sendMailWithDefaultSetting("xx@xx.com,xx@xx.com,xx@xx.com", new Date(), "", "javamail test!!", "hello 我用自己的程序给你发邮件了咯!");
System.out.println(result);
}
}
package javamail;
import java.util.Date;
import javax.mail.Address;
import javax.mail.internet.InternetAddress;
public interface SendMail {
public static String HOST="xx";
public static String SYSTEM_USER="xx";
public static String SYSTEM_USER_ADDRESS="xx@xx.com";
public static String SYSTEM_USER_PASSWORD="xx";
public static String DEFAULT_ENCODING="base64";
public static String DEFAULT_CHARSET="UTF-8";
public static String DEFAULT_PROTOCOL="smtp";
public static boolean SMTP_AUTH = false;
public static boolean ISDEBUG=false;
public static int PORT=25; //不同邮箱端口不同
public static String CONTENT_TYPE="text/plain;charset=utf-8";
/**
* 这个方法包含发送邮件需要配置的所有参数(暂时发送邮件功能不包含附件)
* @param host
* @param port
* @param username
* @param password
* @param subject
* @param contentType
* @param date
* @param header
* @param contents
* @param from
* @param toUsers
* @return
*/
public SendMailResult sendMail(String host,int port,String username,
String password,String subject,String contentType,
Date date,String header,Object contents,Address from,InternetAddress[] toUsers);
/**
* 这个方法根据默认系统配置发送邮件给接收方
* @param toUsers
* @param date
* @param header
* @param subject
* @param contents
* @return
*/
public SendMailResult sendMailWithDefaultSetting(String toUsers,Date date,String header,String subject,String contents);
}
package javamail;
public class SendMailResult {
/**
* returncode 1:服务器地址不存在 ; 2 发送方用户名不存在 3 邮件服务器端口设置不存在 4 发送方地址不存在 5 接收方地址不存在或错误
* 6 邮件服务器连接不上,服务器配置失败 7.系统创建邮箱服务失败
*
*
*/
private int returnCode; //邮件发送返回码
private String returnMessage; //返回的错误信息
public SendMailResult(){
this.returnCode=0;
this.returnMessage="SUCCESS";
}
public SendMailResult(int returnCode, String returnMessage) {
super();
this.returnCode = returnCode;
this.returnMessage = returnMessage;
}
public void setResult(int returnCode,String returnMessage){
this.returnCode = returnCode;
this.returnMessage = searchReturnMessage(returnCode);
}
private String searchReturnMessage(int returnCode){
String result=null;
switch(returnCode){
case 0: result="SUCCESS";
case 1: result="server adress missing !";break;
case 2: result="username missing !";break;
case 3: result="port missing !";break;
case 4: result="sender missing !";break;
case 5: result="receiver missing or wrong!";break;
case 6: result="server connect error,check the server configration!";break;
case 7: result="system error!";break;
case 8: result="username password error !";break;
default: result="";
}
return result;
}
public int getReturnCode() {
return returnCode;
}
public void setReturnCode(int returnCode) {
this.returnCode = returnCode;
this.returnMessage=searchReturnMessage(returnCode); //给code赋值的同时给message赋值;
}
public String getReturnMessage() {
return returnMessage;
}
public void setReturnMessage(String returnMessage) {
this.returnMessage = returnMessage;
}
@Override
public String toString() {
return "ErrorCode:"+returnCode+" ErrorMessage:"+returnMessage;
}
}
package javamail;
import java.util.Date;
import java.util.Properties;
import javax.mail.Address;
import javax.mail.AuthenticationFailedException;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.NoSuchProviderException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import com.sun.mail.util.MailConnectException;
public class SendMailImpl implements SendMail{
public SendMailResult sendMail(String host,int port,String username,
String password,String subject,String contentType,
Date date,String header,Object contents,Address from,InternetAddress[] toUsers){
SendMailResult result = new SendMailResult();
if(isValidInput(result, host, username, port,from,toUsers))
{
Properties prop = mailConfig(true,true,host,username,port);
Session session = Session.getInstance(prop); //根据prop配置创建一个新的session对象
try {
Transport transport = session.getTransport();
transport.connect(host,port,username,password); //建立和邮箱服务器的链接
MimeMessage message = createMessage(session, from, toUsers, header, subject, contents, contentType, date);
transport.sendMessage(message,toUsers); //发送邮件
transport.close();
} catch (NoSuchProviderException e) {
result.setReturnCode(7);
// e.printStackTrace();
return result;
}catch (MessagingException e) {
System.out.println("host:"+host+" port:" +port+" username:"+username+" password:"+password);
if(e instanceof MailConnectException){
result.setReturnCode(6);
}else if(e instanceof AuthenticationFailedException){
result.setReturnCode(8);
}
else
result.setReturnCode(7);
// e.printStackTrace();
return result;
}
return result;
}else{
return result;
}
}
/**
* toUsers 必须是逗号隔开的String字符串
* @param toUsers
* @param date
* @param header
* @param subject
* @param contents
* @return
*/
public SendMailResult sendMailWithDefaultSetting(String toUsers,Date date,String header,String subject,String contents)
{
SendMailResult result =new SendMailResult();
if(toUsers!=null && toUsers.length()>0)
{
try{
InternetAddress[] to=InternetAddress.parse(toUsers);
result = sendMail(SendMail.HOST, SendMail.PORT, SendMail.SYSTEM_USER,SendMail.SYSTEM_USER_PASSWORD,
subject, SendMail.CONTENT_TYPE,date, header, contents, new InternetAddress(SendMail.SYSTEM_USER_ADDRESS),to);
}catch(AddressException e){
result.setReturnCode(5);
}
}
return result;
}
/**
* 邮箱发送方初始配置信息
* @param isDebug
* @param isStrict
* @param hostAddress
* @param username
* @param port
* @return
*/
private Properties mailConfig(boolean isDebug,boolean isStrict,String hostAddress,String username,int port){
Properties prop = new Properties();
String debug = (isDebug)?"true":"false";
String strict = (isStrict)?"true":"false";
hostAddress=(hostAddress==null)? SendMail.HOST : hostAddress;
String protocol=SendMail.DEFAULT_PROTOCOL; //设置发送邮件协议为smtp
port=(port<=0)? SendMail.PORT : port;
username=(hostAddress==null)? SendMail.SYSTEM_USER:username;
prop.setProperty("mail.debug",debug); //是否开启调试
prop.setProperty("mail.mime.address.strict", strict); //邮箱地址是否严格检查
prop.setProperty("mail.protocol.host", hostAddress); //设置邮箱发送服务器地址
prop.setProperty("mail.transport.protocol", protocol); //设置邮箱服务器发送协议smtp
prop.setProperty("mail.protocol.user", username); //设置发送方
prop.setProperty("mail.protocol.port", String.valueOf(port)); //设置邮箱服务器发送端口
return prop;
}
/**
* 构成邮件体的通用方法
* @param session
* @param from
* @param toUsers
* @param header
* @param subject
* @param contents
* @param contentType
* @param sendDate
* @return
*/
private MimeMessage createMessage(Session session,Address from,InternetAddress[] toUsers,String header,String subject,Object contents,String contentType,Date sendDate){
MimeMessage message = new MimeMessage(session); //创建发送邮件体
try {
message.addFrom(new Address[]{from});
message.addHeader(header, header);
message.addRecipients(Message.RecipientType.TO, toUsers);
message.setSubject(subject);
message.setContent(contents, contentType);
if(sendDate.before(new Date())) //如果发送时间为小于当前时间,设为立即时间发送
sendDate = new Date();
message.setSentDate(sendDate); //设定发送时间
} catch (MessagingException e) {
e.printStackTrace();
}
return message;
}
private boolean isValidInput(SendMailResult result,String host,String username,int port,Address from,Address[] to){
if(host==null||host.equals("")){
result.setReturnCode(1);
result.setReturnMessage("server adress missing !");
return false;
}else if(username==null||username.equals(""))
{
result.setReturnCode(2);
return false;
}else if(port<=0)
{
result.setReturnCode(3);
return false;
}else if(from==null){
result.setReturnCode(4);
return false;
}else if(to==null||to.length<1){
result.setReturnCode(5);
return false;
}
return true;
}
public static void main(String[] args) throws Exception {
SendMailResult result = new SendMailImpl().sendMail("mail.xx.com",25, "username","password","java mail test!","text/plain; charset=utf-8",
new Date(),"java mail test!","http://www.baidu.com",new InternetAddress("xx@xx.com"),new InternetAddress[]{new InternetAddress("xx@xx.com"),new InternetAddress("xx@xx.com")});
System.out.println(result);
Thread.sleep(1000);
result = new SendMailImpl().sendMailWithDefaultSetting("xx@xx.com,xx@xx.com,xx@xx.com", new Date(), "", "javamail test!!", "hello 我用自己的程序给你发邮件了咯!");
System.out.println(result);
}
}
package javamail;
import java.util.Date;
import javax.mail.Address;
import javax.mail.internet.InternetAddress;
public interface SendMail {
public static String HOST="xx";
public static String SYSTEM_USER="xx";
public static String SYSTEM_USER_ADDRESS="xx@xx.com";
public static String SYSTEM_USER_PASSWORD="xx";
public static String DEFAULT_ENCODING="base64";
public static String DEFAULT_CHARSET="UTF-8";
public static String DEFAULT_PROTOCOL="smtp";
public static boolean SMTP_AUTH = false;
public static boolean ISDEBUG=false;
public static int PORT=25; //不同邮箱端口不同
public static String CONTENT_TYPE="text/plain;charset=utf-8";
/**
* 这个方法包含发送邮件需要配置的所有参数(暂时发送邮件功能不包含附件)
* @param host
* @param port
* @param username
* @param password
* @param subject
* @param contentType
* @param date
* @param header
* @param contents
* @param from
* @param toUsers
* @return
*/
public SendMailResult sendMail(String host,int port,String username,
String password,String subject,String contentType,
Date date,String header,Object contents,Address from,InternetAddress[] toUsers);
/**
* 这个方法根据默认系统配置发送邮件给接收方
* @param toUsers
* @param date
* @param header
* @param subject
* @param contents
* @return
*/
public SendMailResult sendMailWithDefaultSetting(String toUsers,Date date,String header,String subject,String contents);
}
package javamail;
public class SendMailResult {
/**
* returncode 1:服务器地址不存在 ; 2 发送方用户名不存在 3 邮件服务器端口设置不存在 4 发送方地址不存在 5 接收方地址不存在或错误
* 6 邮件服务器连接不上,服务器配置失败 7.系统创建邮箱服务失败
*
*
*/
private int returnCode; //邮件发送返回码
private String returnMessage; //返回的错误信息
public SendMailResult(){
this.returnCode=0;
this.returnMessage="SUCCESS";
}
public SendMailResult(int returnCode, String returnMessage) {
super();
this.returnCode = returnCode;
this.returnMessage = returnMessage;
}
public void setResult(int returnCode,String returnMessage){
this.returnCode = returnCode;
this.returnMessage = searchReturnMessage(returnCode);
}
private String searchReturnMessage(int returnCode){
String result=null;
switch(returnCode){
case 0: result="SUCCESS";
case 1: result="server adress missing !";break;
case 2: result="username missing !";break;
case 3: result="port missing !";break;
case 4: result="sender missing !";break;
case 5: result="receiver missing or wrong!";break;
case 6: result="server connect error,check the server configration!";break;
case 7: result="system error!";break;
case 8: result="username password error !";break;
default: result="";
}
return result;
}
public int getReturnCode() {
return returnCode;
}
public void setReturnCode(int returnCode) {
this.returnCode = returnCode;
this.returnMessage=searchReturnMessage(returnCode); //给code赋值的同时给message赋值;
}
public String getReturnMessage() {
return returnMessage;
}
public void setReturnMessage(String returnMessage) {
this.returnMessage = returnMessage;
}
@Override
public String toString() {
return "ErrorCode:"+returnCode+" ErrorMessage:"+returnMessage;
}
}
- javax.mail.jar (568.4 KB)
- 下载次数: 6
发表评论
-
自定义xsd扩展
2018-12-24 11:43 1232扩展xsd很简单,官方文档送上:https://docs.s ... -
cglib
2017-06-09 17:54 365import net.sf.cglib.core.Nami ... -
最近学习经验总结二
2017-03-02 15:50 0集合框架: Collection L ... -
最近学习经验总结一
2017-03-02 15:49 0java 基础(重点多线程,锁) ArrayList 数据 ... -
mysql乐观锁/悲观锁
2017-02-24 09:29 0http://chenzhou123520.iteye.co ... -
一致性hash
2017-02-23 19:47 0http://www.blogjava.net/hello-y ... -
单例模式写法之SingletonHolder
2017-02-20 11:16 1197public class SingleDemo { ... -
ThreadLocal源码分析一ThreadLocalMap类
2016-10-21 17:28 0接上文我们将到ThreadLocal基本相当于一个空壳,它 ... -
ThreadLocal源码分析一ThreadLocal类
2016-10-21 17:22 1002ThreadLocal类提供线程局部变量。这些变量和其他普 ... -
阿里巴巴druid源码分析之 filter-chain设计模式
2016-09-20 18:18 7691druid是号称目前最好的java数据库连接池,温少写的代 ... -
ServiceLoader
2016-09-20 15:27 0https://my.oschina.net/hanzhank ... -
驼峰和下划线互转
2016-08-24 11:38 1316public class HumpLineUtil { ... -
java Eclipse配合开启远程debug
2016-08-11 11:18 482远程机器jar方式启动的时候需要指定dubug参数 ... -
java锁之wait,notify(wait会释放锁,notify仅仅只是通知,不释放锁)
2016-07-29 09:40 9364wait是指在一个已经进入了同步锁的线程内,让自己暂 ... -
java锁之CyclicBarrier(互相等待,直到大家都做完,一起开始下面)
2016-07-28 14:43 856参考文章:http://blog.csdn.net/lmc ... -
java锁之CountDownLatch(等待最后一个完成)
2016-07-28 11:19 2036线程同步工具,允许一个线程(或者多个线程)等待其他所有线程 ... -
java锁之Semaphore(信号量,限制并发数量)
2016-07-28 11:17 2077Semaphore也是一个线程同步的辅助类,可以维护当前访 ... -
内部类和final关键字
2016-07-28 11:08 457首先,内部类被编译的时候会生成一个单独的内部类的.class ... -
visitor设计模式
2016-06-29 14:09 324visitor设计模式 visitor设计模式的思 ... -
asm字节码生成技术,cglib
2016-06-29 11:25 643相关技术blog class文件解析: https:/ ...
相关推荐
这个压缩包`javamail1.5.jar`包含了JavaMail的核心库,使得开发者能够方便地与SMTP、POP3和IMAP等邮件协议进行交互。 `javamail1.5.jar`包含以下关键组件: 1. **MIME支持**:JavaMail 使用MIME(多用途互联网邮件...
在1.5版本中,JavaMail API新增了一些功能特性,并对一些接口和实现进行了改进。作为一个官方API,它由Sun Microsystems发布,并在后续由Oracle公司继续维护。JavaMail API提供了邮件传输协议(如SMTP用于发送邮件,...
这个“java_mail 1.5.zip”压缩包包含的是JavaMail 1.5版本的源代码,对于理解其内部工作原理和自定义扩展功能非常有帮助。 JavaMail API的核心组件包括: 1. **JavaMail Session**: 是JavaMail的核心,负责配置...
JavaMail 是一个开源的Java库,它为Java程序员提供了处理电子邮件的能力。这个库允许开发者发送、接收、管理邮件,包括附件、HTML格式的邮件、多部分消息等。在给定的压缩包文件中,我们有两个关键组件:`javax.mail...
很好的邮件处理代码,1.5版本,作为build path放在eclipse里面,就可以用啦! oracle官方推的,很好!jdk1.6版本以上用起来很方便。
一个javamail发送邮件的实例,如果运用于web项目,注意版本冲突的问题.j2ee 1.5 中的mail包中的有个类和mail.jar有冲突,将1.5中mail包中的类删除即可.但是1.4是没有问题的.
JavaMail1.6.0,该版本解决了1.5.x版本上qq邮箱根据uid获取message对象为空的解析bug
8. **JavaMail API**:用于发送和接收电子邮件,提供了与多种邮件服务器交互的接口。 9. **Java Transaction API (JTA)** 和 **Java Message Service (JMS)**:提供了事务管理和消息队列服务,确保了企业级应用的...
标题中的"activation", "commons-email-1.5", 和 "javax.mail" 提及了三个关键概念,它们在Java编程中与电子邮件的发送密切相关。这里主要涉及的是JavaMail API和Apache Commons Email库,这两个是Java环境下处理...
在JDK 1.5环境下,这些步骤是完全支持的,因为JavaMail API在那时已经被广泛使用。需要注意的是,由于安全性和隐私考虑,现代的邮件服务可能要求使用SSL/TLS加密连接,所以在实际应用中,可能需要设置`Properties`...
#### 1.5 创建和填充邮件 创建 `MimeMessage` 对象,设置发件人、收件人、主题和内容。 ```java MimeMessage message = new MimeMessage(session); message.setFrom(new InternetAddress("from@example.com")); ...
在JDK 1.4和JDK 1.5时代,JavaMail API已经相当成熟,可以满足基本的邮件发送需求。下面将详细介绍这两个版本中使用Java发送邮件的关键知识点。 1. **JavaMail API**: JavaMail API是Java平台上的一个开源库,用于...
1. J2SE 1.3 API: 这是Java平台的早期版本,引入了JavaBeans Activation Framework(JAF)和JavaMail API,增强了对EJB的支持,以及对Unicode 3.0的支持。同时,这个版本还改进了垃圾收集机制,提升了性能。 2. ...
4. **JavaMail 1.4**:更新了邮件处理API,支持更丰富的邮件协议和附件处理。 5. **Java Management Extensions (JMX) 1.4**:加强了远程管理和监控能力,便于运维人员对应用进行管理。 `J2EE1.5.chm` 和 `J2EE API...
JMS、JTA、JavaMail、RMI、JNDI 和 JMX 都是 J2EE 1.5 中不可或缺的部分,它们提供了分布式环境中关键的服务和接口,如消息传递、事务管理、邮件服务、远程调用、命名与目录服务以及管理服务。 **总结** J2EE 1.5 ...
<version>1.5 <groupId>javax.mail <artifactId>javax.mail-api <version>1.6.2 <groupId>com.sun.mail</groupId> <artifactId>javax.mail <version>1.6.2 ``` 2. **配置邮件服务器**:创建一...
- `commons-email-1.5-javadoc.jar`:包含Apache Commons Email 1.5版本的Java文档,开发者可以查阅这些文档了解详细API信息。 - `commons-email-1.5-sources.jar`:包含了源代码,对开发者来说非常有用,他们可以...
2. **javax.mail.jar**:这个是JavaMail API的核心库,提供了与邮件服务器交互的接口和类,包括创建、发送和接收邮件。JavaMail API支持多种协议,如SMTP、POP3和IMAP,使得开发者可以方便地在程序中添加邮件功能。 ...
8. **JavaMail API** - 用于发送和接收电子邮件,是企业级应用中常见的功能。 9. **Java Management Extensions (JMX)** - JMX允许创建和管理资源,如监控和管理服务器、应用程序和服务。 10. **Java Naming and...
7. **JavaMail API**:用于处理邮件和消息的发送,接收,提供了一套标准的接口。 8. **Java Authentication and Authorization Service (JAAS)**:提供了用户认证和权限管理的框架,确保了应用的安全性。 9. **...