首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网络技术 > 网络基础 >

施用 common email 发送邮件

2012-10-28 
使用 common email 发送邮件最后从http://commons.apache.org/email/?package org.Miao.Mailimport org.a

使用 common email 发送邮件

最后从http://commons.apache.org/email/

?

package org.Miao.Mail;import org.apache.commons.mail.EmailException;    import org.apache.commons.mail.SimpleEmail;public class Mail {         public static void main(String[] args) throws EmailException {              SimpleEmail email = new SimpleEmail();              email.setHostName("smtp.sina.com");//邮件服务器              email.setAuthentication("*****@sina.com", "******");//smtp认证的用户名和密码              email.addTo("xxxxxx@sohu.com","兔子");//收信者              email.setFrom("xxxxxx@sina.com", "猫咪");//发信者              email.setSubject("猫咪的测试邮件");//标题              email.setCharset("UTF-8");//编码格式              email.setMsg("这是一封猫咪的测试邮件");//内容              email.send();//发送         }}
?

热点排行