heting
BlogJava
::
首頁(yè)
::
新隨筆
::
聯(lián)系
::
聚合
::
管理
::
40 隨筆 :: 9 文章 :: 45 評(píng)論 :: 0 Trackbacks
<
2008年12月
>
日
一
二
三
四
五
六
30
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
1
2
3
4
5
6
7
8
9
10
常用鏈接
我的隨筆
我的評(píng)論
我的參與
最新評(píng)論
留言簿
(3)
給我留言
查看公開留言
查看私人留言
隨筆分類
c#范例(4)
(rss)
java范例
(rss)
js(3)
(rss)
linux(1)
(rss)
WebSphere(1)
(rss)
數(shù)據(jù)庫(kù)(3)
(rss)
隨筆檔案
2010年10月 (1)
2010年8月 (5)
2010年3月 (2)
2009年11月 (2)
2009年9月 (1)
2009年8月 (1)
2009年7月 (2)
2009年5月 (1)
2009年4月 (3)
2009年3月 (4)
2009年2月 (1)
2009年1月 (3)
2008年12月 (2)
2008年11月 (7)
2008年10月 (4)
2008年9月 (1)
文章檔案
2008年9月 (9)
搜索
最新評(píng)論
1.?re: struts2+freemarker中防止表單的重復(fù)提交token
@51互聯(lián)云-濟(jì)南程序猿
你什么都不懂,瞎說(shuō)
--人
2.?re: struts2+freemarker中防止表單的重復(fù)提交token
沒(méi)關(guān)系,大家好,什么都沒(méi)有
--人
3.?re: struts2+freemarker中防止表單的重復(fù)提交token
套頭
--人
4.?re: struts2+freemarker中防止表單的重復(fù)提交token
評(píng)論內(nèi)容較長(zhǎng),點(diǎn)擊標(biāo)題查看
--51互聯(lián)云-濟(jì)南程序猿
5.?re: struts1文件上傳和下載
評(píng)論內(nèi)容較長(zhǎng),點(diǎn)擊標(biāo)題查看
--zuidaima
閱讀排行榜
1.?struts1文件上傳和下載(21137)
2.?javax.naming.CommunicationException 的一個(gè)相關(guān)異常(已解決)(11559)
3.?自己寫的一個(gè)c#winform打印類(8516)
4.?C# 與 C++ 數(shù)據(jù)類型比較及結(jié)構(gòu)體轉(zhuǎn)換 (7225)
5.?WebSphere7.0 上部署struts2 找不到用于處理 JSP 的擴(kuò)展處理器(2991)
評(píng)論排行榜
1.?struts1文件上傳和下載(23)
2.?自己寫的一個(gè)c#winform打印類(8)
3.?struts2+freemarker中防止表單的重復(fù)提交token(6)
4.?Ireport在瀏覽器中的顯示代碼(2)
5.?EJ3.0將EJB程序和WEb程序發(fā)布到weblogic10.3是出現(xiàn)的錯(cuò)誤weblogic.wsee.async.AsyncResponseBean(2)
發(fā)送郵件
import
org.apache.commons.mail.
*
;
public
class
test
{
//
程序主方法
public
static
void
main(String[] args)
throws
Exception
{
test as
=
new
test();
String host
=
"
smtp.sina.com
"
;
String from
=
"
javalihan@sina.com
"
;
String username
=
"
javalihan
"
;
String password
=
"
javame
"
;
//
接收者郵箱
String to
=
"
lbl2006@qq.com
"
;
String subject
=
"
這是測(cè)試主題!
"
;
String mailConent
=
"
這是測(cè)試郵件
"
;
//
調(diào)用發(fā)送附件郵件方法
as.sendAttachmentMail(host, from, username, password, to, subject, mailConent);
}
public
boolean
sendAttachmentMail(String host,String from,String username,
String password,String to,String subject,String mailConent)
throws
Exception
{
//
創(chuàng)建附件對(duì)象
EmailAttachment attachment
=
new
EmailAttachment();
/**/
/*
附件的地址
*/
attachment.setPath(
"
E:\\commons-email-1.0.rar
"
);
//
設(shè)定為附件
attachment.setDisposition(EmailAttachment.ATTACHMENT);
/**/
/*
附件的描述
*/
attachment.setDescription(
"
jPortMap項(xiàng)目設(shè)計(jì)附件文檔
"
);
/**/
/*
附件的名稱,必須和文件名一致
*/
attachment.setName(
"
Eclipse中文教程.pdf
"
);
/**/
/*
new一個(gè)HtmlEmail發(fā)送對(duì)象
*/
HtmlEmail email
=
new
HtmlEmail();
email.setAuthentication(username, password);
email.setHostName(host);
email.addTo(to, from);
email.setFrom(from);
email.setSubject(subject);
//
注意,發(fā)送內(nèi)容時(shí),后面這段會(huì)讓中文正常顯示,否則亂碼
email.setCharset(
"
GB2312
"
);
email.setHtmlMsg(
"
<html>這是封測(cè)試附件郵件</html>
"
);
/**/
/*
郵件內(nèi)容
*/
//
添加附件對(duì)象
email.attach(attachment);
//
發(fā)送
email.send();
System.out.println(
"
帶符件的郵件發(fā)送成功!
"
);
return
true
;
}
}
posted on 2008-12-20 08:48
賀挺
閱讀(140)
評(píng)論(0)
編輯
收藏
新用戶注冊(cè)
刷新評(píng)論列表
只有注冊(cè)用戶
登錄
后才能發(fā)表評(píng)論。
網(wǎng)站導(dǎo)航:
博客園
IT新聞
Chat2DB
C++博客
博問(wèn)
Powered by:
BlogJava
Copyright © 賀挺
主站蜘蛛池模板:
西贡区
|
巴彦淖尔市
|
石渠县
|
松原市
|
乌拉特后旗
|
连南
|
东台市
|
黄龙县
|
隆林
|
浑源县
|
邵武市
|
海南省
|
拜城县
|
兴安盟
|
马尔康县
|
贞丰县
|
恩平市
|
武汉市
|
邹城市
|
洞口县
|
阜新市
|
瓮安县
|
泰宁县
|
平泉县
|
格尔木市
|
平远县
|
根河市
|
大方县
|
杭锦后旗
|
子洲县
|
盘锦市
|
潮安县
|
昔阳县
|
昌乐县
|
大悟县
|
云南省
|
乌鲁木齐市
|
兴山县
|
瑞丽市
|
马关县
|
永寿县
|