?? j-javamail-8-2.html
字號:
</tr>
<tr>
<td class="hbg" height="21" width="160"></td><td class="bbg" valign="top" height="21" colspan="2"> <a href="/developerWorks/cgi-bin/click.cgi?url=http://www-900.ibm.com/cn/" class="mainlink">IBM 主頁</a><span class="divider"> | </span><a href="/developerWorks/cgi-bin/click.cgi?url=http://www-900.ibm.com/cn/products/index.shtml" class="mainlink">產品與服務</a><span class="divider"> | </span><a href="/developerWorks/cgi-bin/click.cgi?url=http://www-900.ibm.com/cn/support/index.shtml" class="mainlink">支持與下載</a><span class="divider"> | </span><a href="/developerWorks/cgi-bin/click.cgi?url=http://www-900.ibm.com/cn/account/index.shtml" class="mainlink">個性化服務</a></td>
</tr>
</table>
<TABLE width="100%" cellspacing="0" cellpadding="0" border="0">
<TR>
<TD bgcolor="#ffffff" height="1" width="150"><IMG src="../i/c.gif" width="150" height="1"></TD>
</TR>
<TR>
<TD bgcolor="#cc6633" height="3" width="150"><IMG src="../i/c.gif" width="150" height="3"></TD>
</TR>
<TR>
<TD bgcolor="#333333" height="1" width="150"><IMG src="../i/c.gif" width="150" height="1"></TD>
</TR>
<TR>
<TD bgcolor="#000000" height="1" width="150"><IMG src="../i/c.gif" width="150" height="1"></TD>
</TR>
<TR>
<TD bgcolor="#ffffff" height="1" width="150"><IMG src="../i/c.gif" width="150" height="2"></TD>
</TR>
</TABLE>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td><font face="Verdana, sans-serif" size="-1"><a href="http://www.ibm.com/">IBM</a> : <a href="/developerWorks/index.shtml">developerWorks 中國網站</a> : <a href="/developerWorks/java/index.shtml">Java</a> : <a href="/developerWorks/cnedu.nsf/java-onlinecourse-bytitle">教學 - 在線教程</a></font>
<br>
<img alt="JavaMail API 基礎" src="imagemaster/masthead.jpg"></td><td width="*" valign="bottom" align="right"><a border="0" href="j-javamail.zip"><img alt="下載 ZIP 文件" border="0" src="../i/icon-zip.gif"></a><a target="_blank" href="../tutorial_eng/index.html" border="0"><img alt="英文原文" border="0" src="../i/icon-source.gif"></a>
</td>
</tr>
<tr>
<td height="2" colspan="2"><img height="2" width="1" src="../i/c.gif"></td>
</tr>
</table>
<TABLE border="0" cellpadding="0" cellspacing="0" width="100%">
<TR>
<TD width="150" height="1" bgcolor="#000000" colspan="6"><IMG alt="" height="1" width="150" src="../i/c.gif"></TD>
</TR>
<TR>
<TD background="../i/sw-gold.gif"><a border="0" href="index.html" onMouseOver="iOver('topmain'); iOver('bottommain'); self.status=mainblurb; return true;" onMouseOut="iOut('topmain'); iOut('bottommain'); self.status=''; return true;"><img alt="主菜單" border="0" src="../i/main.gif" name="topmain"></a></TD><TD background="../i/sw-gold.gif"><a border="0" onMouseOver="iOver('topsection'); iOver('bottomsection'); self.status=sectionblurb; return true;" onMouseOut="iOut('topsection'); iOut('bottomsection'); self.status=''; return true;" href="index8.html"><img alt="章節菜單" border="0" src="../i/section.gif" name="topsection"></a></TD><TD background="../i/sw-gold.gif"><a border="0" onMouseOver="iOver('topfeedback'); iOver('bottomfeedback'); self.status=feedbackblurb; return true;" onMouseOut="iOut('topfeedback'); iOut('bottomfeedback'); self.status=''; return true;" href="j-javamail-9-3.html"><img alt="給出此教程的反饋意見" border="0" src="../i/feedback.gif" name="topfeedback"></a></TD><TD width="100%" background="../i/sw-gold.gif"><img src="../i/c.gif"></TD><TD background="../i/sw-gold.gif"><a border="0" onMouseOver="iOver('topprevious'); iOver('bottomprevious'); self.status=previousblurb; return true;" onMouseOut="iOut('topprevious'); iOut('bottomprevious'); self.status=''; return true;" href="j-javamail-8-1.html"><img alt="上頁" border="0" src="../i/previous.gif" name="topprevious"></a></TD><TD background="../i/sw-gold.gif"><a border="0" onMouseOver="iOver('topnext'); iOver('bottomnext'); self.status=nextblurb; return true;" onMouseOut="iOut('topnext'); iOut('bottomnext'); self.status=''; return true;" href="j-javamail-8-3.html"><img alt="下頁" border="0" src="../i/next.gif" name="topnext"></a></TD>
</TR>
</TABLE>
<table bgcolor="ffffff" cellspacing="0" cellpadding="2" border="0" height="400" width="100%">
<tr valign="bottom">
<a name="navskip"></a><td height="25" colspan="4"><img alt="8.練習" src="imagemaster/titlebar8.jpg" border="0" height="25" width="562"></td>
</tr>
<tr>
<td bgcolor="ffffff" width="15"> </td><td bgcolor="ffffff" width="12"> </td><td valign="top" align="left" bgcolor="ffffff" width="*">
<p>
<br>
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="90%"><font size="4" face="Verdana, Arial, Helvetica"><b>練習 1. 如何設置 JavaMail 環境</b></font></td><td width="200" align="right"><font size="1" face="Verdana, Arial, Helvetica"><nobr> 第 2 頁(共13 頁)</nobr></font></td>
</tr>
</table>
<br>
<br>
</p>
<font size="2" face="Verdana, Arial, Helvetica">
<p>在這個練習中,您將安裝 Sun 的 JavaMail 相關工具。安裝結束后,將介紹符合參考實現的演示程序。</p>
<p>
<b>任務 1:</b>
<br>請下載 Sun 的 <a href="http://java.sun.com/products/javamail/">JavaMail API 實現</a> 的最新版本。
</p>
<p>
<b>任務 2:</b>
<br>請下載 Sun 的 <a href="http://java.sun.com/products/javabeans/glasgow/jaf.html">JavaBeans Activation Framework</a> 的最新版本。</p>
<p>
<b>任務 3:</b>
<br>解壓縮下載的軟件包。您就得到能支持所有平臺的兩個包的 ZIP 文件。</p>
<blockquote>
<p>
<b>任務 3 的幫助:</b>
<br>你可以使用 <code>jar</code> 工具將包解壓縮。</p>
</blockquote>
<p>
<b>任務 4:</b>
<br>
將 JavaMail 1.2 下載軟件包中的 <code>mail.jar</code> 文件以及 JavaBeans Activation Framework 下載軟件包中的 <code>activation.jar</code> 文件添加到您的 <code>CLASSPATH</code> 中。</p>
<blockquote>
<p>
<b>任務 4 的幫助:</b>
<br>將文件復制到您的擴展庫目錄下面。Microsoft Windows 的用戶使用缺省的安裝復制,可輸入如下命令:
</p>
<p>
<pre>
<code style="font-family: Courier New, Courier, monospace; font-size: 12">
cd \javamail-1.2
copy mail.jar \jdk1.3\jre\lib\ext
cd \jaf-1.0.1
copy activation.jar \jdk1.3\jre\lib\ext
</code>
</pre>
</p>
<p>如果您不愿意將文件復制到擴展庫目錄,Sun 提供在 Windows NT 上設置 CLASSPATH 的<a href="http://java.sun.com/products/javamail/classpath-NT.html">詳細指導</a>。</p>
</blockquote>
<p>
<b>任務 5:</b>
<br>
進入 JavaMail API 工具的 <code>demo</code> 目錄,編譯 <code>msgsend</code> 程序以發送一條測試消息。</p>
<blockquote>
<p>
<b>任務 5 的幫助:</b>
<br>
<pre>
<code style="font-family: Courier New, Courier, monospace; font-size: 12">
javac msgsend.java
</code>
</pre>
</p>
</blockquote>
<p>
<b>任務 6:</b>
<br>
執行程序,用 <code>-o</code> 選項傳入 <i>from</i> 地址、用 <code>-M</code> 選項傳入 SMTP 服務器,還有傳入 <i>to</i> 地址(沒有選項)。然后,您輸入主題,消息正文和文件結束符(CTRL-Z)標志消息輸入結束。</p>
<blockquote>
<p>
<b>任務 6 的幫助:</b>
<br>務必替換 <i>from</i> 地址、SMTP 服務器和 <i>to</i> 地址。</p>
<p>
<pre>
<code style="font-family: Courier New, Courier, monospace; font-size: 12">
java msgsend -o from@address -M SMTP.Server to@address
</code>
</pre>
</p>
<p>如果您不能確定您的 SMTP 服務器,請聯系您的系統管理員或與您的互聯網服務供應商核對。</p>
</blockquote>
<p>
<b>任務 7:</b>
<br>
用您的標準郵件閱讀程序(Eudora、Outlook Express、pine...)檢查,確保消息已收到。</p>
<br>
</font></td>
</tr>
</table>
<TABLE border="0" cellpadding="0" cellspacing="0" width="100%">
<TR>
<TD background="../i/sw-gold.gif"><a border="0" href="index.html" onMouseOver="iOver('topmain'); iOver('bottommain'); self.status=mainblurb; return true;" onMouseOut="iOut('topmain'); iOut('bottommain'); self.status=''; return true;"><img alt="主菜單" border="0" src="../i/main.gif" name="bottommain"></a></TD><TD background="../i/sw-gold.gif"><a border="0" onMouseOver="iOver('topsection'); iOver('bottomsection'); self.status=sectionblurb; return true;" onMouseOut="iOut('topsection'); iOut('bottomsection'); self.status=''; return true;" href="index8.html"><img alt="章節菜單" border="0" src="../i/section.gif" name="bottomsection"></a></TD><TD background="../i/sw-gold.gif"><a border="0" onMouseOver="iOver('topfeedback'); iOver('bottomfeedback'); self.status=feedbackblurb; return true;" onMouseOut="iOut('topfeedback'); iOut('bottomfeedback'); self.status=''; return true;" href="j-javamail-9-3.html"><img alt="給出此教程的反饋意見" border="0" src="../i/feedback.gif" name="bottomfeedback"></a></TD><TD width="100%" background="../i/sw-gold.gif"><img src="../i/c.gif"></TD><TD background="../i/sw-gold.gif"><a border="0" onMouseOver="iOver('topprevious'); iOver('bottomprevious'); self.status=previousblurb; return true;" onMouseOut="iOut('topprevious'); iOut('bottomprevious'); self.status=''; return true;" href="j-javamail-8-1.html"><img alt="上頁" border="0" src="../i/previous.gif" name="bottomprevious"></a></TD><TD background="../i/sw-gold.gif"><a border="0" onMouseOver="iOver('topnext'); iOver('bottomnext'); self.status=nextblurb; return true;" onMouseOut="iOut('topnext'); iOut('bottomnext'); self.status=''; return true;" href="j-javamail-8-3.html"><img alt="下頁" border="0" src="../i/next.gif" name="bottomnext"></a></TD>
</TR>
<TR>
<TD width="150" height="1" bgcolor="#000000" colspan="6"><IMG alt="" height="1" width="150" src="../i/c.gif"></TD>
</TR>
</TABLE>
<TABLE width="100%" cellpadding="0" cellspacing="0" border="0">
<TR>
<TD width="100%">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td><img alt="" height="1" width="1" src="../i/c.gif"></td>
</tr>
<tr valign="top">
<td class="bbg" height="21"> <a class="mainlink" href="/developerWorks/cgi-bin/click.cgi?url=http://www-900.ibm.com/cn/ibm/index.shtml">關于 IBM</a><span class="divider"> | </span><a class="mainlink" href="/developerWorks/cgi-bin/click.cgi?url=http://www-900.ibm.com/cn/ibm/privacy/index.shtml">隱私條約</a><span class="divider"> | </span><a class="mainlink" href="/developerWorks/cgi-bin/click.cgi?url=http://www-900.ibm.com/cn/ibm/legal/index.shtml">法律條款</a><span class="divider"> | </span><a class="mainlink" href="/developerWorks/cgi-bin/click.cgi?url=http://www-900.ibm.com/cn/ibm/contact/index.shtml">聯系 IBM</a></td>
</tr>
</table>
</TD>
</TR>
</TABLE>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -