亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? email.java

?? dspace 用j2ee架構的一個數(shù)字圖書館.開源程序
?? JAVA
字號:
/* * Email.java * * Version: $Revision: 1.10 $ * * Date: $Date: 2005/11/21 19:27:26 $ * * Copyright (c) 2002-2005, Hewlett-Packard Company and Massachusetts * Institute of Technology.  All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * - Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * - Neither the name of the Hewlett-Packard Company nor the name of the * Massachusetts Institute of Technology nor the names of their * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. */package org.dspace.core;import java.io.File;import java.text.MessageFormat;import java.util.ArrayList;import java.util.Date;import java.util.Iterator;import java.util.List;import java.util.Properties;import javax.activation.DataHandler;import javax.activation.FileDataSource;import javax.mail.Address;import javax.mail.Authenticator;import javax.mail.BodyPart;import javax.mail.Message;import javax.mail.MessagingException;import javax.mail.Multipart;import javax.mail.PasswordAuthentication;import javax.mail.Session;import javax.mail.Transport;import javax.mail.internet.InternetAddress;import javax.mail.internet.MimeBodyPart;import javax.mail.internet.MimeMessage;import javax.mail.internet.MimeMultipart;/** * Class representing an e-mail message, also used to send e-mails. * <P> * Typical use: * <P> * <code>Email email = ConfigurationManager.getEmail(name);</code><br> * <code>email.addRecipient("foo@bar.com");</code><br> * <code>email.addArgument("John");</code><br> * <code>email.addArgument("On the Testing of DSpace");</code><br> * <code>email.send();</code><br> * <P> * <code>name</code> is the name of an email template in * <code>dspace-dir/config/emails/</code> (which also includes the subject.) * <code>arg0</code> and <code>arg1</code> are arguments to fill out the * message with. * <P> * Emails are formatted using <code>java.text.MessageFormat.</code> * Additionally, comment lines (starting with '#') are stripped, and if a line * starts with "Subject:" the text on the right of the colon is used for the * subject line. For example: * <P> *  * <pre> *     *     # This is a comment line which is stripped *     # *     # Parameters:   {0}  is a person's name *     #               {1}  is the name of a submission *     # *     Subject: Example e-mail *     *     Dear {0}, *     *     Thank you for sending us your submission &quot;{1}&quot;. *      * </pre> *  * <P> * If the example code above was used to send this mail, the resulting mail * would have the subject <code>Example e-mail</code> and the body would be: * <P> *  * <pre> *     *     *     Dear John, *     *     Thank you for sending us your submission &quot;On the Testing of DSpace&quot;. *      * </pre> *  * <P> * Note that parameters like <code>{0}</code> cannot be placed in the subject * of the e-mail; they won't get filled out. *  *  * @author Robert Tansley * @author Jim Downing - added attachment handling code * @version $Revision: 1.10 $ */public class Email{    /*     * Implementation note: It might be necessary to add a quick utility method     * like "send(to, subject, message)". We'll see how far we get without it -     * having all emails as templates in the config allows customisation and      * internationalisation.     *      * Note that everything is stored and the run in send() so that only send()     * throws a MessagingException.     */    /** The content of the message */    private String content;    /** The subject of the message */    private String subject;    /** The arguments to fill out */    private List arguments;    /** The recipients */    private List recipients;    /** Reply to field, if any */    private String replyTo;    private List attachments;    /**     * Create a new email message.     */    Email()    {        arguments = new ArrayList(50);        recipients = new ArrayList(50);        attachments = new ArrayList(10);        subject = "";        content = "";        replyTo = null;    }    /**     * Add a recipient     *      * @param email     *            the recipient's email address     */    public void addRecipient(String email)    {        recipients.add(email);    }    /**     * Set the content of the message. Setting this "resets" the message     * formatting -<code>addArgument</code> will start. Comments and any     * "Subject:" line must be stripped.     *      * @param cnt     *            the content of the message     */    void setContent(String cnt)    {        content = cnt;        arguments = new ArrayList();    }    /**     * Set the subject of the message     *      * @param s     *            the subject of the message     */    void setSubject(String s)    {        subject = s;    }    /**     * Set the reply-to email address     *      * @param email     *            the reply-to email address     */    public void setReplyTo(String email)    {        replyTo = email;    }    /**     * Fill out the next argument in the template     *      * @param arg     *            the value for the next argument     */    public void addArgument(Object arg)    {        arguments.add(arg);    }    public void addAttachment(File f, String name)    {        attachments.add(new FileAttachment(f, name));    }    /**     * "Reset" the message. Clears the arguments and recipients, but leaves the     * subject and content intact.     */    public void reset()    {        arguments = new ArrayList(50);        recipients = new ArrayList(50);        attachments = new ArrayList(10);        replyTo = null;    }    /**     * Sends the email.     *      * @throws MessagingException     *             if there was a problem sending the mail.     */    public void send() throws MessagingException    {        // Get the mail configuration properties        String server = ConfigurationManager.getProperty("mail.server");        String from = ConfigurationManager.getProperty("mail.from.address");        // Set up properties for mail session        Properties props = System.getProperties();        props.put("mail.smtp.host", server);        // Get session        Session session;                // Get the SMTP server authentication information        String username = ConfigurationManager.getProperty("mail.server.username");        String password = ConfigurationManager.getProperty("mail.server.password");                if (username != null)        {            props.put("mail.smtp.auth", "true");            SMTPAuthenticator smtpAuthenticator = new SMTPAuthenticator(                    username, password);            session = Session.getDefaultInstance(props, smtpAuthenticator);        }        else        {            session = Session.getDefaultInstance(props);        }        // Create message        MimeMessage message = new MimeMessage(session);        // Set the recipients of the message        Iterator i = recipients.iterator();        while (i.hasNext())        {            message.addRecipient(Message.RecipientType.TO, new InternetAddress(                    (String) i.next()));        }        // Format the mail message        Object[] args = arguments.toArray();        String fullMessage = MessageFormat.format(content, args);        Date date = new Date();        message.setSentDate(date);        message.setFrom(new InternetAddress(from));        message.setSubject(subject);        if (attachments.isEmpty())        {            message.setText(fullMessage);        }        else        {            Multipart multipart = new MimeMultipart();            // create the first part of the email            BodyPart messageBodyPart = new MimeBodyPart();            messageBodyPart.setText(fullMessage);            multipart.addBodyPart(messageBodyPart);            for (Iterator iter = attachments.iterator(); iter.hasNext();)            {                FileAttachment f = (FileAttachment) iter.next();                // add the file                messageBodyPart = new MimeBodyPart();                messageBodyPart.setDataHandler(new DataHandler(                        new FileDataSource(f.file)));                messageBodyPart.setFileName(f.name);                multipart.addBodyPart(messageBodyPart);            }            message.setContent(multipart);        }        if (replyTo != null)        {            Address[] replyToAddr = new Address[1];            replyToAddr[0] = new InternetAddress(replyTo);            message.setReplyTo(replyToAddr);        }        Transport.send(message);    }    /**     * Utility struct class for handling file attachments.     *      * @author ojd20     *      */    private class FileAttachment    {        public FileAttachment(File f, String n)        {            this.file = f;            this.name = n;        }        File file;        String name;    }        /**     * Inner Class for SMTP authentication information     */    private class SMTPAuthenticator extends Authenticator    {        // User name        private String name;                // Password        private String password;                public SMTPAuthenticator(String n, String p)        {            name = n;            password = p;        }                protected PasswordAuthentication getPasswordAuthentication()        {            return new PasswordAuthentication(name, password);        }    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一区二区三区人| 亚洲欧美一区二区不卡| 国产精品77777| 亚洲国产精品精华液ab| 97久久久精品综合88久久| 亚洲激情欧美激情| 欧美另类久久久品| 久久成人av少妇免费| 欧美激情综合在线| 91成人国产精品| 日本不卡一区二区三区高清视频| 精品国产在天天线2019| 成人精品国产一区二区4080| 亚洲精品日韩一| 欧美美女直播网站| 国产又黄又大久久| 亚洲男人的天堂在线aⅴ视频| 欧美日本精品一区二区三区| 国模套图日韩精品一区二区| 国产精品高潮呻吟久久| 欧美精品久久一区| 国产福利精品一区二区| 亚洲免费在线观看| 精品日韩一区二区三区免费视频| 成人99免费视频| 五月婷婷欧美视频| 国产日韩欧美在线一区| 在线中文字幕一区| 国产一区二区美女| 亚洲综合色噜噜狠狠| 日韩精品中文字幕在线不卡尤物 | 亚洲成人av中文| 精品免费一区二区三区| 91在线观看污| 免费人成网站在线观看欧美高清| 欧美国产综合一区二区| 欧美麻豆精品久久久久久| 国产精品一区二区三区乱码| 一区二区三区在线播放| 精品国产麻豆免费人成网站| 91浏览器在线视频| 韩国一区二区在线观看| 一区二区在线免费观看| 亚洲精品在线免费观看视频| 色88888久久久久久影院按摩| 紧缚奴在线一区二区三区| 亚洲乱码日产精品bd | 91精品国产品国语在线不卡| 国产91高潮流白浆在线麻豆| 婷婷综合在线观看| 综合久久久久久久| 精品美女被调教视频大全网站| 一本一本大道香蕉久在线精品 | 青青草97国产精品免费观看| 国产日产欧美一区二区视频| 51午夜精品国产| 91在线视频播放地址| 黄色资源网久久资源365| 亚洲综合一区在线| 国产精品女同一区二区三区| 日韩精品自拍偷拍| 欧美日本乱大交xxxxx| 99久久综合色| 国产高清精品久久久久| 日本欧美大码aⅴ在线播放| 一区二区三区在线播| 欧美国产日产图区| 亚洲精品在线一区二区| 欧美军同video69gay| 日本高清视频一区二区| 成人精品视频.| 国产一区二区三区免费播放| 日本免费在线视频不卡一不卡二 | 调教+趴+乳夹+国产+精品| 日韩毛片高清在线播放| 蜜桃一区二区三区在线| 亚洲女同ⅹxx女同tv| 中文字幕电影一区| 久久久久成人黄色影片| 欧美成人综合网站| 91精品视频网| 欧美无乱码久久久免费午夜一区 | 欧美精品欧美精品系列| 91高清视频在线| 97久久人人超碰| 成人国产亚洲欧美成人综合网| 国产一区在线精品| 精品一区二区三区在线播放 | 成人午夜激情视频| 国产成人超碰人人澡人人澡| 国内欧美视频一区二区| 捆绑调教一区二区三区| 免费精品视频最新在线| 日韩中文字幕av电影| 亚洲成人免费视频| 亚洲午夜精品在线| 亚洲一区二区三区四区的| 亚洲精品老司机| 亚洲欧美日韩小说| 亚洲乱码日产精品bd| 亚洲欧美日韩国产综合在线| 中文字幕中文字幕一区二区| 欧美激情一区二区三区在线| 日本一区二区三区视频视频| 国产日韩欧美不卡在线| 国产亲近乱来精品视频| 国产欧美精品一区二区色综合| 国产婷婷色一区二区三区在线| 国产片一区二区三区| 国产日韩三级在线| 国产精品毛片久久久久久| 中文字幕一区在线观看视频| 国产精品不卡一区二区三区| 亚洲欧洲国产日本综合| 亚洲日本一区二区| 依依成人综合视频| 亚洲一区二区欧美| 三级在线观看一区二区| 免费观看91视频大全| 精品无人码麻豆乱码1区2区 | 欧美日韩亚洲高清一区二区| 欧美午夜免费电影| 欧美丰满美乳xxx高潮www| 日韩一区和二区| 久久久精品影视| 国产精品欧美一级免费| 亚洲欧美日韩人成在线播放| 亚洲高清中文字幕| 蜜桃视频在线一区| 国产成人av一区二区三区在线| 久久五月婷婷丁香社区| 国产欧美一区二区三区在线看蜜臀| 中文欧美字幕免费| 一区二区久久久久久| 日本亚洲天堂网| 国产乱码精品一区二区三区五月婷| 国产iv一区二区三区| 91蝌蚪porny| 欧美日韩精品三区| 精品国产成人系列| 中文字幕在线一区免费| 亚洲第一电影网| 久久精品国产亚洲一区二区三区| 国产99久久久久| 91极品视觉盛宴| 日韩视频免费观看高清完整版在线观看| 精品国产污污免费网站入口 | 91蝌蚪porny| 91精品国产丝袜白色高跟鞋| 久久久影视传媒| 一区免费观看视频| 视频一区二区国产| 国产精品自在在线| 日本道色综合久久| 欧美大胆人体bbbb| 亚洲日本一区二区| 看电影不卡的网站| 不卡视频在线观看| 69久久99精品久久久久婷婷| 国产亚洲成av人在线观看导航 | 国产一区二区三区高清播放| 97se亚洲国产综合自在线观| 91精选在线观看| 国产精品理论片在线观看| 五月天亚洲婷婷| 成人精品免费视频| 欧美一区二区网站| 中文字幕一区免费在线观看| 日韩精品国产精品| 成人av动漫在线| 日韩一级片网址| 亚洲另类在线一区| 国产一区二区三区最好精华液| 在线观看视频欧美| 久久九九国产精品| 午夜视频在线观看一区| 高清国产一区二区三区| 欧美三级电影网站| 国产精品美女久久久久av爽李琼| 日韩精品一二三区| 97se亚洲国产综合自在线观| 精品国产乱子伦一区| 亚洲一区二区在线免费看| 国产99久久久久| 日韩一区二区视频在线观看| 亚洲日本va在线观看| 国产伦理精品不卡| 欧美日韩国产经典色站一区二区三区 | 欧美一区二区视频网站| 亚洲情趣在线观看| 国产精品一区二区无线| 51精品久久久久久久蜜臀| 中文字幕一区二| 黑人巨大精品欧美一区| 欧美日韩国产小视频在线观看| 国产精品麻豆视频| 国产九九视频一区二区三区| 欧美精品在线一区二区三区| 亚洲啪啪综合av一区二区三区| 国产做a爰片久久毛片|