<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    貝貝爸爸的程序人生

    關注Seam、BPM
    posts - 23, comments - 10, trackbacks - 0, articles - 32
      BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理
    首先,需要配置mail-service.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- $Id: mail-service.xml 62350 2007-04-15 16:50:12Z dimitris@jboss.org $ -->
    <server>

      
    <!-- ==================================================================== -->
      
    <!-- Mail Connection Factory                                              -->
      
    <!-- ==================================================================== -->

      
    <mbean code="org.jboss.mail.MailService"
             name
    ="jboss:service=Mail">
        
    <attribute name="JNDIName">java:/Mail</attribute>
        
    <attribute name="User">bpm</attribute>
        
    <attribute name="Password">*****</attribute>
        
    <attribute name="Configuration">
          
    <!-- A test configuration -->
          
    <configuration>
            
    <!-- Change to your mail server prototocol -->
            
    <property name="mail.store.protocol" value="pop3"/>
            
    <property name="mail.transport.protocol" value="smtp"/>

            
    <!-- Change to the user who will receive mail  -->
            
    <property name="mail.user" value="bpm"/>
            
    <property name="mail.smtp.auth" value="true"/>

            
    <!-- Change to the mail server  -->
            
    <property name="mail.pop3.host" value="**pop3服務器地址**"/>

            
    <!-- Change to the SMTP gateway server -->
            
    <property name="mail.smtp.host" value="***smtp服務器地址***"/>
            
            
    <!-- The mail server port -->
            
    <property name="mail.smtp.port" value="25"/>
            
            
    <!-- Change to the address mail will be from  -->
            
    <property name="mail.from" value="bpm@eontime.com.cn"/>

            
    <!-- Enable debugging output from the javamail classes -->
            
    <property name="mail.debug" value="false"/>
          
    </configuration>
        
    </attribute>
        
    <depends>jboss:service=Naming</depends>
      
    </mbean>

    </server>

    其次新建一個jsp頁面mail2.jsp,作為測試
    <%@page contentType="text/html"%>
    <%@ page import="javax.mail.*,javax.mail.internet.*, javax.activation.*, javax.naming.InitialContext" %> 
    <h3>Test JbsssMail DB</h3> 
    <%
    String toAddress
    =request.getParameter("MailTo");
    String fromAddress
    =request.getParameter("MailFrom");
    String subject
    =request.getParameter("MailSubject");
    String content
    =request.getParameter("MailContent");
    InitialContext ctx 
    = new InitialContext(); 
    Session sessions 
    = (Session) ctx.lookup("java:/Mail");
    if(toAddress!=null &&!toAddress.equals("")){ 
    try{
     MimeMessage msg 
    = new MimeMessage(sessions);
     msg.setFrom(
    new InternetAddress(fromAddress));
     msg.setRecipients(javax.mail.Message.RecipientType.TO,toAddress);
     msg.setSubject(subject);
     msg.setSentDate(
    new java.util.Date());
     Multipart multipt 
    = new MimeMultipart();
     MimeBodyPart msgbody 
    = new MimeBodyPart();
     msgbody.setContent(content,
    "text/plain");
     multipt.addBodyPart(msgbody);
     msg.setContent(multipt);
     Transport.send(msg);
     System.out.println(
    "SendMail OK!");
    }
    catch(MessagingException e)
    {
     e.printStackTrace();
    }
    }
    %> 
    <HTML>
    <BODY BGCOLOR="white">
    <form METHOD="POST" ACTION="mail2.jsp">
     
    <table CELLSPACING="0" CELLPADDING="3" BORDER="1" WIDTH="474">
        
    <tr>
          
    <td width="150"><div align="left">From :</small></td>
          
    <td width="324"><input TYPE="TEXT" name="MailFrom" value=""></td>
        
    </tr>
        
    <tr>
          
    <td width="150"><div align="left">To :</small></td>
          
    <td width="324"><input TYPE="TEXT" name="MailTo" value=""></td>
        
    </tr>
        
    <tr>
          
    <td width="150"><div align="left">Subject :</small></td>
          
    <td width="324"><input TYPE="TEXT" name="MailSubject" value=""></td>
        
    </tr>
        
    <tr>
          
    <td width="150"><div align="left">Content :</small></td>
          
    <td width="324"><TEXTAREA cols=50 name="MailContent" rows=8></TEXTAREA></td>
        
    </tr>
        
    <tr>
          
    <td></td>
          
    <td colspan="2" width="474"><input TYPE="Submit"></td>
        
    </tr>
     
    </table>
    </form>
    </BODY>
    </HTML>

    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    主站蜘蛛池模板: 免费夜色污私人影院网站| 亚洲一卡2卡3卡4卡乱码 在线| 日本亚洲中午字幕乱码| 免费鲁丝片一级在线观看| 亚洲av成人一区二区三区| av无码免费一区二区三区| 亚洲欧洲另类春色校园小说| 2021精品国产品免费观看| 18gay台湾男同亚洲男同| 1000部国产成人免费视频| 亚洲精品一区二区三区四区乱码| 95老司机免费福利| 亚洲日产2021三区| 毛片免费视频观看| 久久精品国产亚洲av瑜伽| 亚洲精品国自产拍在线观看| 中国黄色免费网站| 亚洲午夜未满十八勿入| 成人女人A级毛片免费软件| 亚洲JLZZJLZZ少妇| 亚洲国产成人乱码精品女人久久久不卡 | 四虎影视www四虎免费| 欧美亚洲精品一区二区| 免费人成视频在线观看不卡| 一级黄色免费大片| 亚洲AV无码成人精品区蜜桃 | 日本亚洲免费无线码| 亚洲一区二区观看播放| 亚洲精品国产精品国自产观看| 成全视频免费观看在线看| 亚洲婷婷在线视频| 免费真实播放国产乱子伦| 国产成人精品免费久久久久| 亚洲精品二三区伊人久久| 五月婷婷亚洲综合| 中文字幕免费在线观看| 性色av极品无码专区亚洲| 亚洲AV永久无码精品一百度影院 | 又粗又大又硬又爽的免费视频| a级成人毛片免费视频高清| 国产精品亚洲四区在线观看 |