Coverage report

  %line %branch
com.ozacc.mail.Mail$AttachmentFile
0% 
0% 

 1  
 package com.ozacc.mail;
 2  
 
 3  
 import java.io.File;
 4  
 import java.io.InputStream;
 5  
 import java.io.UnsupportedEncodingException;
 6  
 import java.net.URL;
 7  
 import java.util.ArrayList;
 8  
 import java.util.Collections;
 9  
 import java.util.HashMap;
 10  
 import java.util.Iterator;
 11  
 import java.util.List;
 12  
 import java.util.Map;
 13  
 
 14  
 import javax.activation.DataSource;
 15  
 import javax.activation.FileDataSource;
 16  
 import javax.activation.FileTypeMap;
 17  
 import javax.activation.URLDataSource;
 18  
 import javax.mail.internet.AddressException;
 19  
 import javax.mail.internet.InternetAddress;
 20  
 
 21  
 import com.ozacc.mail.impl.ByteArrayDataSource;
 22  
 import com.ozacc.mail.impl.Cp932;
 23  
 
 24  
 /**
 25  
  * ¥á¡¼¥?¡£
 26  
  * 
 27  
  * @since 1.0
 28  
  * @author Tomohiro Otsuka
 29  
  * @version $Id: Mail.java,v 1.10.2.5 2005/01/23 10:39:11 otsuka Exp $
 30  
  */
 31  
 public class Mail {
 32  
 
 33  
 	/** <code>ISO-2022-JP</code> */
 34  
 	public static final String JIS_CHARSET = "ISO-2022-JP";
 35  
 
 36  
 	public static final String DOCTYPE_PUBLIC = "-//OZACC//DTD MAIL//EN";
 37  
 
 38  
 	public static final String DOCTYPE_SYSTEM = "http://www.ozacc.com/library/dtd/ozacc-mail.dtd";
 39  
 
 40  
 	public static final String DOCTYPE_PUBLIC_MULTIPLE = "-//OZACC//DTD MULTIPLE MAILS//EN";
 41  
 
 42  
 	public static final String DOCTYPE_SYSTEM_MULTIPLE = "http://www.ozacc.com/library/dtd/ozacc-multiple-mails.dtd";
 43  
 
 44  
 	private String charset = JIS_CHARSET;
 45  
 
 46  
 	protected String text;
 47  
 
 48  
 	protected InternetAddress from;
 49  
 
 50  
 	protected String subject;
 51  
 
 52  
 	protected List to;
 53  
 
 54  
 	protected List cc;
 55  
 
 56  
 	protected List bcc;
 57  
 
 58  
 	protected List envelopeTo;
 59  
 
 60  
 	protected InternetAddress returnPath;
 61  
 
 62  
 	protected InternetAddress replyTo;
 63  
 
 64  
 	protected String importance;
 65  
 
 66  
 	protected Map headers;
 67  
 
 68  
 	protected String htmlText;
 69  
 
 70  
 	protected List attachmentFiles;
 71  
 
 72  
 	/**
 73  
 	 * ¥³¥ó¥¹¥È¥é¥¯¥¿¡£
 74  
 	 */
 75  
 	public Mail() {}
 76  
 
 77  
 	/**
 78  
 	 * ¥³¥ó¥¹¥È¥é¥¯¥¿¡£
 79  
 	 * °¸Àè¤äº¹½Ð¿Í¤Î̾Á°¤ò¥¨¥ó¥³¡¼¥É¤¹¤?»?¤Ë»ÈÍѤ¹¤?ʸ»ú¥³¡¼¥É¤ò»ØÄꤷ¤Þ¤¹¡£
 80  
 	 * ¥Ç¥Õ¥©¥?¥È¤Ï<code>ISO-2022-JP</code>¤Ç¤¹¡£
 81  
 	 * <p>
 82  
 	 * Æ?Ëܸ?´Ä¶­¤ÇÍøÍѤ¹¤?¾?¹ç¤ÏÄ̾?Êѹ¹¤¹¤?ɬÍפϤ¢¤ê¤Þ¤»¤ó¡£
 83  
 	 * 
 84  
 	 * @param charset ¥¨¥ó¥³¡¼¥É¤Ë»ÈÍѤ¹¤?ʸ»ú¥³¡¼¥É
 85  
 	 */
 86  
 	public Mail(String charset) {
 87  
 		this();
 88  
 		this.charset = charset;
 89  
 	}
 90  
 
 91  
 	/**
 92  
 	 * ¥³¥Ô¡¼¥³¥ó¥¹¥È¥é¥¯¥¿¡£
 93  
 	 * ¥·¥ã¥ú½¼¥³¥Ô¡¼(shallow copy)¤Ç¤¹¡£
 94  
 	 * 
 95  
 	 * @since 1.0.2
 96  
 	 * 
 97  
 	 * @param original ¥³¥Ô¡¼¸µ¤ÎMail¥¤¥ó¥¹¥¿¥ó¥¹
 98  
 	 */
 99  
 	public Mail(Mail original) {
 100  
 		this.bcc = original.bcc;
 101  
 		this.cc = original.cc;
 102  
 		this.charset = original.charset;
 103  
 		this.from = original.from;
 104  
 		this.importance = original.importance;
 105  
 		this.replyTo = original.replyTo;
 106  
 		this.returnPath = original.returnPath;
 107  
 		this.subject = original.subject;
 108  
 		this.text = original.text;
 109  
 		this.to = original.to;
 110  
 		this.headers = original.headers;
 111  
 		this.htmlText = original.htmlText;
 112  
 		this.attachmentFiles = original.attachmentFiles;
 113  
 		this.envelopeTo = original.envelopeTo;
 114  
 	}
 115  
 
 116  
 	/**
 117  
 	 * ¥¨¥ó¥³¡¼¥É¤Ë»ÈÍѤ¹¤?ʸ»ú¥³¡¼¥É¤òÊÖ¤·¤Þ¤¹¡£
 118  
 	 * 
 119  
 	 * @return ¥¨¥ó¥³¡¼¥É¤Ë»ÈÍѤ¹¤?ʸ»ú¥³¡¼¥É
 120  
 	 */
 121  
 	public String getCharset() {
 122  
 		return charset;
 123  
 	}
 124  
 
 125  
 	/**
 126  
 	 * ¥á¡¼¥?¤Î½ÅÍ×ÅÙ¤ò¥»¥Ã¥È¤·¤Þ¤¹¡£
 127  
 	 * °ú¿ô¤Ç»ØÄ?²Äǽ¤ÊÃͤϡÖhigh¡×¡¢¡Önormal¡×¡¢¡Ölow¡×¤Î¤¤¤º¤?¤«¤Ç¤¹¡£
 128  
 	 * 
 129  
 	 * @param importance ¥á¡¼¥?¤Î½ÅÍ×ÅÙ¡£¡Öhigh¡×¡¢¡Önormal¡×¡¢¡Ölow¡×¤Î¤¤¤º¤?¤«¡£
 130  
 	 * @throws IllegalArgumentException »ØÄ?²Äǽ¤ÊÃͰʳ°¤¬»ØÄꤵ¤?¤¿¾?¹?
 131  
 	 * 
 132  
 	 * @see Mail.Importance
 133  
 	 */
 134  
 	public void setImportance(String importance) throws IllegalArgumentException {
 135  
 		if ("high".equals(importance) || "normal".equals(importance) || "low".equals(importance)) {
 136  
 			this.importance = importance;
 137  
 		} else {
 138  
 			throw new IllegalArgumentException("'" + importance + "'¤Ï¡¢¥á¡¼¥?½ÅÍ×Å٤ˤϻØÄê¤Ç¤­¤Ê¤¤ÃͤǤ¹¡£");
 139  
 		}
 140  
 	}
 141  
 
 142  
 	/**
 143  
 	 * ¥á¡¼¥?¤Î½ÅÍ×ÅÙ¤òÊÖ¤·¤Þ¤¹¡£
 144  
 	 * ÃͤϡÖhigh¡×¡¢¡Önormal¡×¡¢¡Ölow¡×¤Î¤¤¤º¤?¤«¤Ç¤¹¡£
 145  
 	 * 
 146  
 	 * @return ¥á¡¼¥?¤Î½ÅÍ×ÅÙ¡£¡Öhigh¡×¡¢¡Önormal¡×¡¢¡Ölow¡×¤Î¤¤¤º¤?¤«¡£
 147  
 	 */
 148  
 	public String getImportance() {
 149  
 		return importance;
 150  
 	}
 151  
 
 152  
 	/**
 153  
 	 * ¥á¡¼¥?¤ÎÁ÷¿®À襢¥É¥?¥¹¤òÄɲä·¤Þ¤¹¡£
 154  
 	 * 
 155  
 	 * @param address Á÷¿®À襢¥É¥?¥¹
 156  
 	 */
 157  
 	public void addTo(InternetAddress address) {
 158  
 		if (to == null) {
 159  
 			to = new ArrayList();
 160  
 		}
 161  
 		to.add(address);
 162  
 	}
 163  
 
 164  
 	/**
 165  
 	 * ¥á¡¼¥?¤ÎÁ÷¿®À襢¥É¥?¥¹¤òÄɲä·¤Þ¤¹¡£
 166  
 	 * 
 167  
 	 * @param email Á÷¿®À襢¥É¥?¥¹
 168  
 	 * @throws IllegalArgumentException ÉÔÀµ¤Ê¥Õ¥©¡¼¥Þ¥Ã¥È¤Î¥¢¥É¥?¥¹¤¬»ØÄꤵ¤?¤¿¾?¹?
 169  
 	 */
 170  
 	public void addTo(String email) throws IllegalArgumentException {
 171  
 		try {
 172  
 			addTo(new InternetAddress(email));
 173  
 		} catch (AddressException e) {
 174  
 			throw new IllegalArgumentException(e.getMessage());
 175  
 		}
 176  
 	}
 177  
 
 178  
 	/**
 179  
 	 * ¥á¡¼¥?¤ÎÁ÷¿®Àè̾¤È¥¢¥É¥?¥¹¤òÄɲä·¤Þ¤¹¡£
 180  
 	 * ̾Á°¤ÏJIS_CHARSET¤Ç¥¨¥ó¥³¡¼¥É¤µ¤?¤Þ¤¹¡£
 181  
 	 * 
 182  
 	 * @param email Á÷¿®À襢¥É¥?¥¹
 183  
 	 * @param name Á÷¿®Àè̾
 184  
 	 * @throws IllegalArgumentException ÉÔÀµ¤Ê¥Õ¥©¡¼¥Þ¥Ã¥È¤Î¥¢¥É¥?¥¹¤¬»ØÄꤵ¤?¤¿¾?¹?
 185  
 	 */
 186  
 	public void addTo(String email, String name) throws IllegalArgumentException {
 187  
 		if (charset.equals(JIS_CHARSET)) {
 188  
 			name = Cp932.toJIS(name);
 189  
 		}
 190  
 		try {
 191  
 			addTo(new InternetAddress(email, name, charset));
 192  
 		} catch (UnsupportedEncodingException e) {
 193  
 			throw new IllegalArgumentException(e.getMessage());
 194  
 		}
 195  
 	}
 196  
 
 197  
 	/**
 198  
 	 * ¥á¡¼¥?¤ÎÁ÷¿®À襢¥É¥?¥¹¤ÎÇÛÎó¤òÊÖ¤·¤Þ¤¹¡£
 199  
 	 * Á÷¿®À襢¥É¥?¥¹¤¬°?·?¤â¥»¥Ã¥È¤µ¤?¤Æ¤¤¤Ê¤¤¤È¤­¤Ï¶õ¤ÎÇÛÎó¤òÊÖ¤·¤Þ¤¹¡£
 200  
 	 * 
 201  
 	 * @return Á÷¿®À襢¥É¥?¥¹¤ÎÇÛÎ?
 202  
 	 */
 203  
 	public InternetAddress[] getTo() {
 204  
 		if (to == null) {
 205  
 			return new InternetAddress[0];
 206  
 		}
 207  
 		return (InternetAddress[])to.toArray(new InternetAddress[to.size()]);
 208  
 	}
 209  
 
 210  
 	/**
 211  
 	 * CC¥¢¥É¥?¥¹¤òÄɲä·¤Þ¤¹¡£
 212  
 	 * 
 213  
 	 * @param address CC¤Î¥¢¥É¥?¥¹
 214  
 	 */
 215  
 	public void addCc(InternetAddress address) {
 216  
 		if (cc == null) {
 217  
 			cc = new ArrayList();
 218  
 		}
 219  
 		cc.add(address);
 220  
 	}
 221  
 
 222  
 	/**
 223  
 	 * CC¥¢¥É¥?¥¹¤òÄɲä·¤Þ¤¹¡£
 224  
 	 * 
 225  
 	 * @param email CC¤Î¥¢¥É¥?¥¹
 226  
 	 * @throws IllegalArgumentException ÉÔÀµ¤Ê¥Õ¥©¡¼¥Þ¥Ã¥È¤Î¥¢¥É¥?¥¹¤¬»ØÄꤵ¤?¤¿¾?¹?
 227  
 	 */
 228  
 	public void addCc(String email) throws IllegalArgumentException {
 229  
 		try {
 230  
 			addCc(new InternetAddress(email));
 231  
 		} catch (AddressException e) {
 232  
 			throw new IllegalArgumentException(e.getMessage());
 233  
 		}
 234  
 	}
 235  
 
 236  
 	/**
 237  
 	 * CC¤Î°¸Ì¾¤È¥¢¥É¥?¥¹¤òÄɲä·¤Þ¤¹¡£
 238  
 	 * ̾Á°¤ÏJIS_CHARSET¤Ç¥¨¥ó¥³¡¼¥É¤µ¤?¤Þ¤¹¡£
 239  
 	 * 
 240  
 	 * @param email CC¤Î¥¢¥É¥?¥¹
 241  
 	 * @param name CC¤Î°¸Ì¾
 242  
 	 * @throws IllegalArgumentException ÉÔÀµ¤Ê¥Õ¥©¡¼¥Þ¥Ã¥È¤Î¥¢¥É¥?¥¹¤¬»ØÄꤵ¤?¤¿¾?¹?
 243  
 	 */
 244  
 	public void addCc(String email, String name) throws IllegalArgumentException {
 245  
 		if (charset.equals(JIS_CHARSET)) {
 246  
 			name = Cp932.toJIS(name);
 247  
 		}
 248  
 		try {
 249  
 			addCc(new InternetAddress(email, name, charset));
 250  
 		} catch (UnsupportedEncodingException e) {
 251  
 			throw new IllegalArgumentException(e.getMessage());
 252  
 		}
 253  
 	}
 254  
 
 255  
 	/**
 256  
 	 * ¥á¡¼¥?¤ÎCC¥¢¥É¥?¥¹ÇÛÎó¤òÊÖ¤·¤Þ¤¹¡£
 257  
 	 * CC¥¢¥É¥?¥¹¤¬°?·?¤â¥»¥Ã¥È¤µ¤?¤Æ¤¤¤Ê¤¤¤È¤­¤Ï¶õ¤ÎÇÛÎó¤òÊÖ¤·¤Þ¤¹¡£
 258  
 	 * 
 259  
 	 * @return CC¥¢¥É¥?¥¹¤ÎÇÛÎ?
 260  
 	 */
 261  
 	public InternetAddress[] getCc() {
 262  
 		if (cc == null) {
 263  
 			return new InternetAddress[0];
 264  
 		}
 265  
 		return (InternetAddress[])cc.toArray(new InternetAddress[cc.size()]);
 266  
 	}
 267  
 
 268  
 	/**
 269  
 	 * BCC¥¢¥É¥?¥¹¤òÄɲä·¤Þ¤¹¡£
 270  
 	 * 
 271  
 	 * @param address BCC¤Î¥¢¥É¥?¥¹
 272  
 	 */
 273  
 	public void addBcc(InternetAddress address) {
 274  
 		if (bcc == null) {
 275  
 			bcc = new ArrayList();
 276  
 		}
 277  
 		bcc.add(address);
 278  
 	}
 279  
 
 280  
 	/**
 281  
 	 * BCC¥¢¥É¥?¥¹¤òÄɲä·¤Þ¤¹¡£
 282  
 	 * 
 283  
 	 * @param email BCC¤Î¥¢¥É¥?¥¹
 284  
 	 * @throws IllegalArgumentException ÉÔÀµ¤Ê¥Õ¥©¡¼¥Þ¥Ã¥È¤Î¥¢¥É¥?¥¹¤¬»ØÄꤵ¤?¤¿¾?¹?
 285  
 	 */
 286  
 	public void addBcc(String email) throws IllegalArgumentException {
 287  
 		try {
 288  
 			addBcc(new InternetAddress(email));
 289  
 		} catch (AddressException e) {
 290  
 			throw new IllegalArgumentException(e.getMessage());
 291  
 		}
 292  
 	}
 293  
 
 294  
 	/**
 295  
 	 * ¥á¡¼¥?¤ÎBCC¥¢¥É¥?¥¹¤ÎÇÛÎó¤òÊÖ¤·¤Þ¤¹¡£
 296  
 	 * BCC¥¢¥É¥?¥¹¤¬°?·?¤â¥»¥Ã¥È¤µ¤?¤Æ¤¤¤Ê¤¤¤È¤­¤Ï¶õ¤ÎÇÛÎó¤òÊÖ¤·¤Þ¤¹¡£
 297  
 	 * 
 298  
 	 * @return BCC¥¢¥É¥?¥¹¤ÎÇÛÎ?
 299  
 	 */
 300  
 	public InternetAddress[] getBcc() {
 301  
 		if (bcc == null) {
 302  
 			return new InternetAddress[0];
 303  
 		}
 304  
 		return (InternetAddress[])bcc.toArray(new InternetAddress[bcc.size()]);
 305  
 	}
 306  
 
 307  
 	/**
 308  
 	 * ¥á¡¼¥?¤Îº¹½Ð¿Í¥¢¥É¥?¥¹¤ò¥»¥Ã¥È¤·¤Þ¤¹¡£
 309  
 	 * 
 310  
 	 * @param address º¹½Ð¿Í¥¢¥É¥?¥¹
 311  
 	 */
 312  
 	public void setFrom(InternetAddress address) {
 313  
 		from = address;
 314  
 	}
 315  
 
 316  
 	/**
 317  
 	 * ¥á¡¼¥?¤Îº¹½Ð¿Í¥¢¥É¥?¥¹¤ò¥»¥Ã¥È¤·¤Þ¤¹¡£
 318  
 	 * 
 319  
 	 * @param email º¹½Ð¿Í¥¢¥É¥?¥¹
 320  
 	 * @throws IllegalArgumentException ÉÔÀµ¤Ê¥Õ¥©¡¼¥Þ¥Ã¥È¤Î¥¢¥É¥?¥¹¤¬»ØÄꤵ¤?¤¿¾?¹?
 321  
 	 */
 322  
 	public void setFrom(String email) throws IllegalArgumentException {
 323  
 		try {
 324  
 			setFrom(new InternetAddress(email));
 325  
 		} catch (AddressException e) {
 326  
 			throw new IllegalArgumentException(e.getMessage());
 327  
 		}
 328  
 	}
 329  
 
 330  
 	/**
 331  
 	 * ¥á¡¼¥?¤Îº¹½Ð¿Í̾¤È¥¢¥É¥?¥¹¤ò¥»¥Ã¥È¤·¤Þ¤¹¡£
 332  
 	 * ̾Á°¤ÏJIS_CHARSET¤Ç¥¨¥ó¥³¡¼¥É¤µ¤?¤Þ¤¹¡£
 333  
 	 * 
 334  
 	 * @param email º¹½Ð¿Í¥¢¥É¥?¥¹
 335  
 	 * @param name º¹½Ð¿Í̾
 336  
 	 * @throws IllegalArgumentException ÉÔÀµ¤Ê¥Õ¥©¡¼¥Þ¥Ã¥È¤Î¥¢¥É¥?¥¹¤¬»ØÄꤵ¤?¤¿¾?¹?
 337  
 	 */
 338  
 	public void setFrom(String email, String name) throws IllegalArgumentException {
 339  
 		if (charset.equals(JIS_CHARSET)) {
 340  
 			name = Cp932.toJIS(name);
 341  
 		}
 342  
 		try {
 343  
 			setFrom(new InternetAddress(email, name, charset));
 344  
 		} catch (UnsupportedEncodingException e) {
 345  
 			throw new IllegalArgumentException(e.getMessage());
 346  
 		}
 347  
 	}
 348  
 
 349  
 	/**
 350  
 	 * ¥á¡¼¥?¤Îº¹½Ð¿Í¥¢¥É¥?¥¹¤òÊÖ¤·¤Þ¤¹¡£¥»¥Ã¥È¤µ¤?¤Æ¤¤¤Ê¤¤¾?¹ç¤Ïnull¤òÊÖ¤·¤Þ¤¹¡£
 351  
 	 * 
 352  
 	 * @return ¥á¡¼¥?¤Îº¹½Ð¿Í¥¢¥É¥?¥¹
 353  
 	 */
 354  
 	public InternetAddress getFrom() {
 355  
 		return from;
 356  
 	}
 357  
 
 358  
 	/**
 359  
 	 * Return-Path¥¢¥É¥?¥¹¤ò¥»¥Ã¥È¤·¤Þ¤¹¡£
 360  
 	 * 
 361  
 	 * @param address Return-Path¥¢¥É¥?¥¹
 362  
 	 */
 363  
 	public void setReturnPath(InternetAddress address) {
 364  
 		returnPath = address;
 365  
 	}
 366  
 
 367  
 	/**
 368  
 	 * Return-Path¥¢¥É¥?¥¹¤ò¥»¥Ã¥È¤·¤Þ¤¹¡£
 369  
 	 * 
 370  
 	 * @param email Return-Path¥¢¥É¥?¥¹
 371  
 	 * @throws IllegalArgumentException ÉÔÀµ¤Ê¥Õ¥©¡¼¥Þ¥Ã¥È¤Î¥¢¥É¥?¥¹¤¬»ØÄꤵ¤?¤¿¾?¹?
 372  
 	 */
 373  
 	public void setReturnPath(String email) throws IllegalArgumentException {
 374  
 		try {
 375  
 			setReturnPath(new InternetAddress(email));
 376  
 		} catch (AddressException e) {
 377  
 			throw new IllegalArgumentException(e.getMessage());
 378  
 		}
 379  
 	}
 380  
 
 381  
 	/**
 382  
 	 * Return-Path¥¢¥É¥?¥¹¤òÊÖ¤·¤Þ¤¹¡£
 383  
 	 * 
 384  
 	 * @return Return-Path¥¢¥É¥?¥¹
 385  
 	 */
 386  
 	public InternetAddress getReturnPath() {
 387  
 		return class="keyword">returnPath;
 388  
 	}
 389  
 
 390  
 	/**
 391  
 	 * ÊÖ¿®À襢¥É¥?¥¹¤ò¥»¥Ã¥È¤·¤Þ¤¹¡£
 392  
 	 * 
 393  
 	 * @param address ÊÖ¿®À襢¥É¥?¥¹
 394  
 	 */
 395  
 	public void setReplyTo(InternetAddress address) {
 396  
 		replyTo = address;
 397  
 	}
 398  
 
 399  
 	/**
 400  
 	 * ÊÖ¿®À襢¥É¥?¥¹¤ò¥»¥Ã¥È¤·¤Þ¤¹¡£
 401  
 	 * 
 402  
 	 * @param email ÊÖ¿®À襢¥É¥?¥¹
 403  
 	 * @throws IllegalArgumentException ÉÔÀµ¤Ê¥Õ¥©¡¼¥Þ¥Ã¥È¤Î¥¢¥É¥?¥¹¤¬»ØÄꤵ¤?¤¿¾?¹?
 404  
 	 */
 405  
 	public void setReplyTo(String email) throws IllegalArgumentException {
 406  
 		try {
 407  
 			setReplyTo(new InternetAddress(email));
 408  
 		} catch (AddressException e) {
 409  
 			throw new IllegalArgumentException(e.getMessage());
 410  
 		}
 411  
 	}
 412  
 
 413  
 	/**
 414  
 	 * ¥á¡¼¥?¤ÎÊÖ¿®À襢¥É¥?¥¹¤òÊÖ¤·¤Þ¤¹¡£¥»¥Ã¥È¤µ¤?¤Æ¤¤¤Ê¤¤¾?¹ç¤Ïnull¤òÊÖ¤·¤Þ¤¹¡£
 415  
 	 * 
 416  
 	 * @return ÊÖ¿®À襢¥É¥?¥¹
 417  
 	 */
 418  
 	public InternetAddress getReplyTo() {
 419  
 		return replyTo;
 420  
 	}
 421  
 
 422  
 	/**
 423  
 	 * ¥á¡¼¥?¤Î·?̾¤òÊÖ¤·¤Þ¤¹¡£¥»¥Ã¥È¤µ¤?¤Æ¤¤¤Ê¤¤¾?¹ç¤Ï¶õʸ»úÎó¤òÊÖ¤·¤Þ¤¹¡£
 424  
 	 * 
 425  
 	 * @return ¥á¡¼¥?¤Î·?̾
 426  
 	 */
 427  
 	public String getSubject() {
 428  
 		if (subject == null) {
 429  
 			return "";
 430  
 		}
 431  
 		return subject;
 432  
 	}
 433  
 
 434  
 	/**
 435  
 	 * ¥á¡¼¥?¤Î·?̾¤ò¥»¥Ã¥È¤·¤Þ¤¹¡£
 436  
 	 * 
 437  
 	 * @param subject ¥á¡¼¥?¤Î·?̾
 438  
 	 */
 439  
 	public void setSubject(String subject) {
 440  
 		this.subject = subject;
 441  
 	}
 442  
 
 443  
 	/**
 444  
 	 * ¥á¡¼¥?ËÜʸ¤òÊÖ¤·¤Þ¤¹¡£
 445  
 	 * ËÜʸ¥»¥Ã¥È¤µ¤?¤Æ¤¤¤Ê¤¤¾?¹ç¤Ï¶õʸ»úÎó¤òÊÖ¤·¤Þ¤¹¡£
 446  
 	 * 
 447  
 	 * @return ¥á¡¼¥?ËÜʸ
 448  
 	 */
 449  
 	public String getText() {
 450  
 		if (text == null) {
 451  
 			return "";
 452  
 		}
 453  
 		return text;
 454  
 	}
 455  
 
 456  
 	/**
 457  
 	 * ¥á¡¼¥?ËÜʸ¤ò¥»¥Ã¥È¤·¤Þ¤¹¡£
 458  
 	 * 
 459  
 	 * @param text ¥á¡¼¥?ËÜʸ
 460  
 	 */
 461  
 	public void setText(String text) {
 462  
 		this.text = text;
 463  
 	}
 464  
 
 465  
 	/**
 466  
 	 * ¥á¡¼¥?¥Ø¥Ã¥À¤ËǤ°Õ¤Î¥Ø¥Ã¥À¥Õ¥£¡¼¥?¥É¤òÄɲä·¤Þ¤¹¡£
 467  
 	 * Ǥ°Õ¥Ø¥Ã¥À¤Ï¡ÖX-key: value¡×¤Î¥Õ¥©¡¼¥Þ¥Ã¥È¤Ç¥á¡¼¥?¥Ø¥Ã¥À¤ËÁȤ߹?¤Þ¤?¤Þ¤¹¡£<br>
 468  
 	 * Ʊ¤¸¥Ø¥Ã¥À̾¤ÎÃͤϾå½ñ¤­¤µ¤?¤Þ¤¹¡£
 469  
 	 *  
 470  
 	 * @param name Ǥ°Õ¥Ø¥Ã¥À̾¡£Æ¬¤¬"X-"¤Ç»Ï¤Þ¤Ã¤Æ¤¤¤Ê¤±¤?¤Ð¡¢¼«Æ°Åª¤ËÉÕÍ¿¤µ¤?¤Þ¤¹¡£
 471  
 	 * @param value Ǥ°Õ¥Ø¥Ã¥À¤ÎÃÍ
 472  
 	 */
 473  
 	public void addXHeader(String name, String value) {
 474  
 		if (headers == null) {
 475  
 			headers = new HashMap();
 476  
 		}
 477  
 		if (name.startsWith("X-")) {
 478  
 			headers.put(name, value);
 479  
 		} else {
 480  
 			headers.put("X-" + name, value);
 481  
 		}
 482  
 	}
 483  
 
 484  
 	/**
 485  
 	 * ¥á¡¼¥?¥Ø¥Ã¥À¤ËǤ°Õ¤Î¥Ø¥Ã¥À¥Õ¥£¡¼¥?¥É¤òÄɲä·¤Þ¤¹¡£<br>
 486  
 	 * Ʊ¤¸¥Ø¥Ã¥À̾¤ÎÃͤϾå½ñ¤­¤µ¤?¤Þ¤¹¡£
 487  
 	 * 
 488  
 	 * @since 1.2
 489  
 	 * @param name Ǥ°Õ¥Ø¥Ã¥À̾
 490  
 	 * @param value Ǥ°Õ¥Ø¥Ã¥À¤ÎÃÍ
 491  
 	 */
 492  
 	public void addHeader(String name, String value) {
 493  
 		if (headers == null) {
 494  
 			headers = new HashMap();
 495  
 		}
 496  
 		headers.put(name, value);
 497  
 	}
 498  
 
 499  
 	/**
 500  
 	 * ¥á¡¼¥?¤ÎǤ°Õ¥Ø¥Ã¥À̾¤ÈÃͤÎMap¥¤¥ó¥¹¥¿¥ó¥¹¤òÊÖ¤·¤Þ¤¹¡£
 501  
 	 * Ǥ°Õ¥Ø¥Ã¥À¤¬°?·?¤â¥»¥Ã¥È¤µ¤?¤Æ¤¤¤Ê¤¤¤È¤­¤Ïnull¤òÊÖ¤·¤Þ¤¹¡£
 502  
 	 * <p>
 503  
 	 * ¤³¤ÎMap¥¤¥ó¥¹¥¿¥ó¥¹¤Ø¤Î½¤Àµ¤Ï¤Ç¤­¤Þ¤»¤ó¡£(unmodifiableMap¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£)
 504  
 	 * 
 505  
 	 * @return ¥á¡¼¥?¤ÎǤ°Õ¥Ø¥Ã¥À̾¤ÈÃͤÎMap¥¤¥ó¥¹¥¿¥ó¥¹¡£¤Þ¤¿¤Ïnull¡£
 506  
 	 */
 507  
 	public Map getHeaders() {
 508  
 		if (headers == null) {
 509  
 			return null;
 510  
 		}
 511  
 		return Collections.unmodifiableMap(headers);
 512  
 	}
 513  
 
 514  
 	/**
 515  
 	 * ¥á¡¼¥?ÆâÍÆ¤ò½ÐÎϤ·¤Þ¤¹¡£<br>
 516  
 	 * ¥á¡¼¥?¤Î¥½¡¼¥¹¤Ë»÷¤¿¥Õ¥©¡¼¥Þ¥Ã¥È¤Ç½ÐÎϤµ¤?¤Þ¤¹¡£
 517  
 	 * 
 518  
 	 * @see java.lang.Object#toString()
 519  
 	 */
 520  
 	public String toString() {
 521  
 		StringBuffer buf = new StringBuffer(1000);
 522  
 		buf.append("Mail\n");
 523  
 		buf.append("Return-Path: ").append(returnPath).append("\n");
 524  
 		buf.append("From: ").append(from != null ? from.toUnicodeString() : class="keyword">null).append("\n");
 525  
 		buf.append("To: ").append(arrayToCommaDelimitedString(to)).append("\n");
 526  
 		buf.append("Cc: ").append(arrayToCommaDelimitedString(cc)).append("\n");
 527  
 		buf.append("Bcc: ").append(arrayToCommaDelimitedString(bcc)).append("\n");
 528  
 		buf.append("Subject: ").append(subject).append("\n");
 529  
 
 530  
 		if (headers != null) {
 531  
 			for (Iterator itr = headers.keySet().iterator(); itr.hasNext();) {
 532  
 				String header = (String)itr.next();
 533  
 				String value = (String)headers.get(header);
 534  
 				buf.append(header).append(": ").append(value).append("\n");
 535  
 			}
 536  
 		}
 537  
 
 538  
 		buf.append("\n");
 539  
 		buf.append(text);
 540  
 
 541  
 		if (htmlText != null) {
 542  
 			buf.append("\n\n-----\n\n");
 543  
 			buf.append(htmlText);
 544  
 		}
 545  
 
 546  
 		return buf.toString();
 547  
 	}
 548  
 
 549  
 	/**
 550  
 	 * @param list
 551  
 	 * @return 
 552  
 	 */
 553  
 	protected String arrayToCommaDelimitedString(List list) {
 554  
 		if (list == null) {
 555  
 			return "null";
 556  
 		} else {
 557  
 			StringBuffer sb = new StringBuffer();
 558  
 			for (int i = 0, num = list.size(); i < num; i++) {
 559  
 				if (i > 0) {
 560  
 					sb.append(", ");
 561  
 				}
 562  
 				sb.append(((InternetAddress)list.get(i)).toUnicodeString());
 563  
 			}
 564  
 			return sb.toString();
 565  
 		}
 566  
 	}
 567  
 
 568  
 	/**
 569  
 	 * ¥»¥Ã¥È¤µ¤?¤Æ¤¤¤?Á÷¿®À襢¥É¥?¥¹(To¥¢¥É¥?¥¹)¤òÁ´¤Æ¥¯¥?¥¢¤·¤Þ¤¹¡£
 570  
 	 *
 571  
 	 * @since 1.0.2
 572  
 	 */
 573  
 	public void clearTo() {
 574  
 		to = null;
 575  
 	}
 576  
 
 577  
 	/**
 578  
 	 * ¥»¥Ã¥È¤µ¤?¤Æ¤¤¤?CC¥¢¥É¥?¥¹¤òÁ´¤Æ¥¯¥?¥¢¤·¤Þ¤¹¡£
 579  
 	 *
 580  
 	 * @since 1.0.2
 581  
 	 */
 582  
 	public void clearCc() {
 583  
 		cc = null;
 584  
 	}
 585  
 
 586  
 	/**
 587  
 	 * ¥»¥Ã¥È¤µ¤?¤Æ¤¤¤?BCC¥¢¥É¥?¥¹¤òÁ´¤Æ¥¯¥?¥¢¤·¤Þ¤¹¡£
 588  
 	 *
 589  
 	 * @since 1.0.2
 590  
 	 */
 591  
 	public void clearBcc() {
 592  
 		bcc = null;
 593  
 	}
 594  
 
 595  
 	/**
 596  
 	 * HTML¤ÎËÜʸ¤ò¥»¥Ã¥È¤·¤Þ¤¹¡£
 597  
 	 * 
 598  
 	 * @since 1.1
 599  
 	 * 
 600  
 	 * @param htmlText HTML¤ÎËÜʸ
 601  
 	 */
 602  
 	public void setHtmlText(String htmlText) {
 603  
 		this.htmlText = htmlText;
 604  
 	}
 605  
 
 606  
 	/**
 607  
 	 * HTML¤ÎËÜʸ¤òÊÖ¤·¤Þ¤¹¡£
 608  
 	 * 
 609  
 	 * @since 1.1
 610  
 	 * 
 611  
 	 * @return HTML¤ÎËÜʸ¡£¤Þ¤¿¤Ïnull¡£
 612  
 	 */
 613  
 	public String getHtmlText() {
 614  
 		return htmlText;
 615  
 	}
 616  
 
 617  
 	/**
 618  
 	 * »ØÄꤵ¤?¤¿¥Õ¥¡¥¤¥?¤òźÉÕ¤·¤Þ¤¹¡£
 619  
 	 * źÉÕ¥Õ¥¡¥¤¥?̾¤Ë¤Ï¡¢»ØÄꤵ¤?¤¿¥Õ¥¡¥¤¥?¤Î̾Á°¤¬»ÈÍѤµ¤?¤Þ¤¹¡£
 620  
 	 * ¤³¤Î¥Õ¥¡¥¤¥?¤Î̾Á°¤ÏŬÀڤʳÈÄ¥»Ò¤¬ÉÕ¤±¤é¤?¤Æ¤¤¤?ɬÍפ¬¤¢¤ê¤Þ¤¹¡£
 621  
 	 * 
 622  
 	 * @since 1.1
 623  
 	 * 
 624  
 	 * @param file źÉÕ¥Õ¥¡¥¤¥?
 625  
 	 */
 626  
 	public void addFile(File file) {
 627  
 		if (attachmentFiles == null) {
 628  
 			initAttachmentFiles();
 629  
 		}
 630  
 		addFile(file, file.getName());
 631  
 	}
 632  
 
 633  
 	/**
 634  
 	 * »ØÄꤵ¤?¤¿¥Õ¥¡¥¤¥?¤òźÉÕ¤·¤Þ¤¹¡£
 635  
 	 * »ØÄꤹ¤?¥Õ¥¡¥¤¥?̾¤Ë¤ÏŬÀڤʳÈÄ¥»Ò¤¬ÉÕ¤±¤é¤?¤Æ¤¤¤?ɬÍפ¬¤¢¤ê¤Þ¤¹¡£
 636  
 	 * 
 637  
 	 * @since 1.1
 638  
 	 * 
 639  
 	 * @param file źÉÕ¥Õ¥¡¥¤¥?
 640  
 	 * @param fileName ¥Õ¥¡¥¤¥?̾
 641  
 	 */
 642  
 	public void addFile(File file, String fileName) {
 643  
 		if (attachmentFiles == null) {
 644  
 			initAttachmentFiles();
 645  
 		}
 646  
 		attachmentFiles.add(new AttachmentFile(fileName, file));
 647  
 	}
 648  
 
 649  
 	/**
 650  
 	 * »ØÄꤵ¤?¤¿URL¤Î¥Õ¥¡¥¤¥?¤òźÉÕ¤·¤Þ¤¹¡£
 651  
 	 * »ØÄꤹ¤?¥Õ¥¡¥¤¥?̾¤Ë¤ÏŬÀڤʳÈÄ¥»Ò¤¬ÉÕ¤±¤é¤?¤Æ¤¤¤?ɬÍפ¬¤¢¤ê¤Þ¤¹¡£
 652  
 	 * 
 653  
 	 * @since 1.1
 654  
 	 * 
 655  
 	 * @param url źÉÕ¥Õ¥¡¥¤¥?
 656  
 	 * @param fileName ¥Õ¥¡¥¤¥?̾
 657  
 	 */
 658  
 	public void addFile(URL url, String fileName) {
 659  
 		if (attachmentFiles == null) {
 660  
 			initAttachmentFiles();
 661  
 		}
 662  
 		attachmentFiles.add(new AttachmentFile(fileName, url));
 663  
 	}
 664  
 
 665  
 	/**
 666  
 	 * »ØÄꤵ¤?¤¿InputStream¤ò¥Õ¥¡¥¤¥?¤È¤·¤ÆÅºÉÕ¤·¤Þ¤¹¡£
 667  
 	 * »ØÄꤹ¤?¥Õ¥¡¥¤¥?̾¤Ë¤ÏŬÀڤʳÈÄ¥»Ò¤¬ÉÕ¤±¤é¤?¤Æ¤¤¤?ɬÍפ¬¤¢¤ê¤Þ¤¹¡£
 668  
 	 * 
 669  
 	 * @since 1.1
 670  
 	 * 
 671  
 	 * @param is źÉÕ¥Õ¥¡¥¤¥?¤òÀ¸À®¤¹¤?InputStream
 672  
 	 * @param fileName ¥Õ¥¡¥¤¥?̾
 673  
 	 */
 674  
 	public void addFile(InputStream is, String fileName) {
 675  
 		if (attachmentFiles == null) {
 676  
 			initAttachmentFiles();
 677  
 		}
 678  
 		attachmentFiles.add(new AttachmentFile(fileName, is));
 679  
 	}
 680  
 
 681  
 	/**
 682  
 	 * attachmentFiles¥×¥úÁѥƥ£¤ò½é´?²½¡£
 683  
 	 */
 684  
 	private void initAttachmentFiles() {
 685  
 		attachmentFiles = new ArrayList();
 686  
 	}
 687  
 
 688  
 	/**
 689  
 	 * źÉÕ¥Õ¥¡¥¤¥?¤ÎÇÛÎó¤òÊÖ¤·¤Þ¤¹¡£
 690  
 	 * źÉÕ¥Õ¥¡¥¤¥?¤¬¥»¥Ã¥È¤µ¤?¤Æ¤¤¤Ê¤¤¾?¹ç¤Ï¡¢¶õ¤ÎÇÛÎó¤òÊÖ¤·¤Þ¤¹¡£
 691  
 	 * 
 692  
 	 * @since 1.1
 693  
 	 * 
 694  
 	 * @return źÉÕ¥Õ¥¡¥¤¥?¤ÎÇÛÎ󡣤ޤ¿¤Ï¶õ¤ÎÇÛÎó¡£
 695  
 	 */
 696  
 	public AttachmentFile[] getAttachmentFiles() {
 697  
 		if (attachmentFiles == null) {
 698  
 			return new AttachmentFile[0];
 699  
 		}
 700  
 		return (AttachmentFile[])attachmentFiles
 701  
 				.toArray(new AttachmentFile[attachmentFiles.size()]);
 702  
 	}
 703  
 
 704  
 	/**
 705  
 	 * HTML¤ÎËÜʸ¤¬¥»¥Ã¥È¤µ¤?¤Æ¤¤¤?¤«¤É¤¦¤«È½Äꤷ¤Þ¤¹¡£
 706  
 	 * 
 707  
 	 * @since 1.1
 708  
 	 * 
 709  
 	 * @return HTML¤ÎËÜʸ¤¬¥»¥Ã¥È¤µ¤?¤Æ¤¤¤?¾?¹? true
 710  
 	 */
 711  
 	public boolean isHtmlMail() {
 712  
 		return (htmlText != null);
 713  
 	}
 714  
 
 715  
 	/**
 716  
 	 * ¥Õ¥¡¥¤¥?¤¬ÅºÉÕ¤µ¤?¤Æ¤¤¤?¤«¤É¤¦¤«È½Äꤷ¤Þ¤¹¡£
 717  
 	 * 
 718  
 	 * @since 1.1
 719  
 	 * 
 720  
 	 * @return ¥Õ¥¡¥¤¥?¤¬ÅºÉÕ¤µ¤?¤Æ¤¤¤?¾?¹? true
 721  
 	 */
 722  
 	public boolean isFileAttached() {
 723  
 		return attachmentFiles != null && attachmentFiles.size() > 0;
 724  
 	}
 725  
 
 726  
 	/**
 727  
 	 * ¥Þ¥?¥Á¥Ñ¡¼¥È¡¦¥á¡¼¥?¤«¤É¤¦¤«È½Äꤷ¤Þ¤¹¡£<br>
 728  
 	 * HTMLËÜʸ¤¬¥»¥Ã¥È¤µ¤?¤Æ¤¤¤?¤«¡¢¥Õ¥¡¥¤¥?¤¬ÅºÉÕ¤µ¤?¤Æ¤¤¤?¾?¹ç¤Ë true ¤¬ÊÖ¤µ¤?¤Þ¤¹¡£
 729  
 	 * <p>
 730  
 	 * Ã?: ¤³¤³¤ÇȽÄꤵ¤?¤?¥Þ¥?¥Á¥Ñ¡¼¥È¤Ï¡¢¸·Ì©¤Ê°ÕÌ£¤Ç¤Î¥Þ¥?¥Á¥Ñ¡¼¥È¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£
 731  
 	 * 
 732  
 	 * @since 1.1
 733  
 	 * 
 734  
 	 * @return ¥Þ¥?¥Á¥Ñ¡¼¥È¡¦¥á¡¼¥?¤Î¾?¹? true
 735  
 	 */
 736  
 	public boolean isMultipartMail() {
 737  
 		return isHtmlMail() || isFileAttached();
 738  
 	}
 739  
 
 740  
 	/**
 741  
 	 * ¥»¥Ã¥È¤µ¤?¤Æ¤¤¤?źÉÕ¥Õ¥¡¥¤¥?¤òÁ´¤Æ¥¯¥?¥¢¤·¤Þ¤¹¡£
 742  
 	 * 
 743  
 	 * @since 1.1
 744  
 	 */
 745  
 	public void clearFile() {
 746  
 		initAttachmentFiles();
 747  
 	}
 748  
 
 749  
 	/**
 750  
 	 * envelope-to¤Î°¸À襢¥É¥?¥¹¤òÄɲä·¤Þ¤¹¡£
 751  
 	 * <p>
 752  
 	 * envelope-to¥¢¥É¥?¥¹¤¬¥»¥Ã¥È¤µ¤?¤Æ¤¤¤?¾?¹ç¡¢envelope-to¤Î¥¢¥É¥?¥¹¤Ë¤Î¤ß¥á¡¼¥?¤òÁ÷¿®¤·¡¢
 753  
 	 * To¡¢Cc¡¢Bcc¥¢¥É¥?¥¹¤Ë¤Ï¼ÂºÝ¤Ë¤ÏÁ÷¿®¤µ¤?¤Þ¤»¤ó¡£
 754  
 	 * 
 755  
 	 * @since 1.2
 756  
 	 * @param address
 757  
 	 */
 758  
 	public void addEnvelopeTo(InternetAddress address) {
 759  
 		if (envelopeTo == null) {
 760  
 			envelopeTo = new ArrayList();
 761  
 		}
 762  
 		envelopeTo.add(address);
 763  
 	}
 764  
 
 765  
 	/**
 766  
 	 * envelope-to¤Î°¸À襢¥É¥?¥¹¤òÄɲä·¤Þ¤¹¡£
 767  
 	 * <p>
 768  
 	 * envelope-to¥¢¥É¥?¥¹¤¬¥»¥Ã¥È¤µ¤?¤Æ¤¤¤?¾?¹ç¡¢envelope-to¤Î¥¢¥É¥?¥¹¤Ë¤Î¤ß¥á¡¼¥?¤òÁ÷¿®¤·¡¢
 769  
 	 * To¡¢Cc¡¢Bcc¥¢¥É¥?¥¹¤Ë¤Ï¼ÂºÝ¤Ë¤ÏÁ÷¿®¤µ¤?¤Þ¤»¤ó¡£
 770  
 	 * 
 771  
 	 * @since 1.2
 772  
 	 * @param email
 773  
 	 * @throws IllegalArgumentException ÉÔÀµ¤Ê¥Õ¥©¡¼¥Þ¥Ã¥È¤Î¥¢¥É¥?¥¹¤¬»ØÄꤵ¤?¤¿¾?¹?
 774  
 	 */
 775  
 	public void addEnvelopeTo(String email) {
 776  
 		try {
 777  
 			addEnvelopeTo(new InternetAddress(email));
 778  
 		} catch (AddressException e) {
 779  
 			throw new IllegalArgumentException(e.getMessage());
 780  
 		}
 781  
 	}
 782  
 
 783  
 	/**
 784  
 	 * envelope-to¤Î°¸À襢¥É¥?¥¹¤òÄɲä·¤Þ¤¹¡£
 785  
 	 * <p>
 786  
 	 * envelope-to¥¢¥É¥?¥¹¤¬¥»¥Ã¥È¤µ¤?¤Æ¤¤¤?¾?¹ç¡¢envelope-to¤Î¥¢¥É¥?¥¹¤Ë¤Î¤ß¥á¡¼¥?¤òÁ÷¿®¤·¡¢
 787  
 	 * To¡¢Cc¡¢Bcc¥¢¥É¥?¥¹¤Ë¤Ï¼ÂºÝ¤Ë¤ÏÁ÷¿®¤µ¤?¤Þ¤»¤ó¡£
 788  
 	 * 
 789  
 	 * @since 1.2
 790  
 	 * @param addresses
 791  
 	 */
 792  
 	public void addEnvelopeTo(InternetAddress[] addresses) {
 793  
 		for (int i = 0; i < addresses.length; i++) {
 794  
 			addEnvelopeTo(addresses[i]);
 795  
 		}
 796  
 	}
 797  
 
 798  
 	/**
 799  
 	 * envelope-to¤Î°¸À襢¥É¥?¥¹¤òÄɲä·¤Þ¤¹¡£
 800  
 	 * <p>
 801  
 	 * envelope-to¥¢¥É¥?¥¹¤¬¥»¥Ã¥È¤µ¤?¤Æ¤¤¤?¾?¹ç¡¢envelope-to¤Î¥¢¥É¥?¥¹¤Ë¤Î¤ß¥á¡¼¥?¤òÁ÷¿®¤·¡¢
 802  
 	 * To¡¢Cc¡¢Bcc¥¢¥É¥?¥¹¤Ë¤Ï¼ÂºÝ¤Ë¤ÏÁ÷¿®¤µ¤?¤Þ¤»¤ó¡£
 803  
 	 * 
 804  
 	 * @since 1.2
 805  
 	 * @param emails
 806  
 	 * @throws IllegalArgumentException ÉÔÀµ¤Ê¥Õ¥©¡¼¥Þ¥Ã¥È¤Î¥¢¥É¥?¥¹¤¬»ØÄꤵ¤?¤¿¾?¹?
 807  
 	 */
 808  
 	public void addEnvelopeTo(String[] emails) {
 809  
 		for (int i = 0; i < emails.length; i++) {
 810  
 			addEnvelopeTo(emails[i]);
 811  
 		}
 812  
 	}
 813  
 
 814  
 	/**
 815  
 	 * ¥»¥Ã¥È¤µ¤?¤Æ¤¤¤?envelope-to¥¢¥É¥?¥¹¤òÁ´¤Æ¥¯¥?¥¢¤·¤Þ¤¹¡£
 816  
 	 *
 817  
 	 * @since 1.2
 818  
 	 */
 819  
 	public void clearEnvelopeTo() {
 820  
 		envelopeTo = null;
 821  
 	}
 822  
 
 823  
 	/**
 824  
 	 * envelope-to¥¢¥É¥?¥¹ÇÛÎó¤òÊÖ¤·¤Þ¤¹¡£
 825  
 	 * envelope-to¥¢¥É¥?¥¹¤¬°?·?¤â¥»¥Ã¥È¤µ¤?¤Æ¤¤¤Ê¤¤¤È¤­¤Ï¶õ¤ÎÇÛÎó¤òÊÖ¤·¤Þ¤¹¡£
 826  
 	 * 
 827  
 	 * @since 1.2
 828  
 	 * @return envelope-to¥¢¥É¥?¥¹¤ÎÇÛÎ?
 829  
 	 */
 830  
 	public InternetAddress[] getEnvelopeTo() {
 831  
 		if (envelopeTo == null) {
 832  
 			return new InternetAddress[0];
 833  
 		}
 834  
 		return (InternetAddress[])envelopeTo.toArray(new InternetAddress[envelopeTo.size()]);
 835  
 	}
 836  
 
 837  
 	/**
 838  
 	 * źÉÕ¥Õ¥¡¥¤¥?¡£
 839  
 	 * <p>
 840  
 	 * ¼õ¿®¥á¡¼¥?(ReceivedMail)¤ÎźÉÕ¥Õ¥¡¥¤¥?¤Ï¡¢¾?¤Ë<code>getFile()</code>¥á¥½¥Ã¥É¤Ç¼èÆÀ¤·¤Þ¤¹¡£
 841  
 	 * <code>getInputStream()</code>¡¢<code>getUrl()</code>¥á¥½¥Ã¥É¤Ïnull¤òÊÖ¤·¤Þ¤¹¡£
 842  
 	 * ¼õ¿®¥á¡¼¥?¤ËÂФ·¤Æ¤Ï¡¢<code>ReceivedMail.getFiles()</code>¥á¥½¥Ã¥É¤ò»È¤¦¤ÈźÉÕ¥Õ¥¡¥¤¥?¤Î
 843  
 	 * <code>File</code>¥¤¥ó¥¹¥¿¥ó¥¹ÇÛÎó¤ò¼èÆÀ¤¹¤?¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
 844  
 	 * 
 845  
 	 * @since 1.1
 846  
 	 * @author Tomohiro Otsuka
 847  
 	 * @version $Id: Mail.java,v 1.10.2.5 2005/01/23 10:39:11 otsuka Exp $
 848  
 	 */
 849  
 	public class AttachmentFile {
 850  
 
 851  
 		private String name;
 852  
 
 853  
 		private File file;
 854  
 
 855  
 		private InputStream is;
 856  
 
 857  
 		private URL url;
 858  
 
 859  
 		/**
 860  
 		 * ¥Õ¥¡¥¤¥?̾¤È¥Õ¥¡¥¤¥?¤ò»ØÄꤷ¤Æ¡¢¤³¤Î¥¯¥é¥¹¤Î¥¤¥ó¥¿¥ó¥¹¤òÀ¸À®¤·¤Þ¤¹¡£
 861  
 		 * ¥Õ¥¡¥¤¥?̾¤Ë¤ÏŬÀڤʳÈÄ¥»Ò¤¬ÉÕ¤±¤é¤?¤Æ¤¤¤?ɬÍפ¬¤¢¤ê¤Þ¤¹¡£
 862  
 		 * 
 863  
 		 * @param name ¥á¡¼¥?¤Ëɽ¼¨¤¹¤?¥Õ¥¡¥¤¥?̾
 864  
 		 * @param file źÉÕ¥Õ¥¡¥¤¥?
 865  
 		 */
 866  0
 		public AttachmentFile(String name, File file) {
 867  0
 			this.name = name;
 868  0
 			this.file = file;
 869  0
 		}
 870  
 
 871  
 		/**
 872  
 		 * ¥Õ¥¡¥¤¥?̾¤ÈInputStream¤ò»ØÄꤷ¤Æ¡¢¤³¤Î¥¯¥é¥¹¤Î¥¤¥ó¥¿¥ó¥¹¤òÀ¸À®¤·¤Þ¤¹¡£
 873  
 		 * ¥Õ¥¡¥¤¥?̾¤Ë¤ÏŬÀڤʳÈÄ¥»Ò¤¬ÉÕ¤±¤é¤?¤Æ¤¤¤?ɬÍפ¬¤¢¤ê¤Þ¤¹¡£
 874  
 		 * 
 875  
 		 * @param name ¥á¡¼¥?¤Ëɽ¼¨¤¹¤?¥Õ¥¡¥¤¥?̾
 876  
 		 * @param is źÉÕ¥Õ¥¡¥¤¥?¤òÀ¸À®¤¹¤?InputStream
 877  
 		 */
 878  0
 		public AttachmentFile(String name, InputStream is) {
 879  0
 			this.name = name;
 880  0
 			this.is = is;
 881  0
 		}
 882  
 
 883  
 		/**
 884  
 		 * ¥Õ¥¡¥¤¥?̾¤È¥Õ¥¡¥¤¥?¥úÁ±¡¼¥·¥ç¥ó¤ÎURL¤ò»ØÄꤷ¤Æ¡¢¤³¤Î¥¯¥é¥¹¤Î¥¤¥ó¥¿¥ó¥¹¤òÀ¸À®¤·¤Þ¤¹¡£
 885  
 		 * ¥Õ¥¡¥¤¥?̾¤Ë¤ÏŬÀڤʳÈÄ¥»Ò¤¬ÉÕ¤±¤é¤?¤Æ¤¤¤?ɬÍפ¬¤¢¤ê¤Þ¤¹¡£
 886  
 		 * 
 887  
 		 * @param name ¥á¡¼¥?¤Ëɽ¼¨¤¹¤?¥Õ¥¡¥¤¥?̾
 888  
 		 * @param url źÉÕ¥Õ¥¡¥¤¥?¤Î¥úÁ±¡¼¥·¥ç¥óURL
 889  
 		 */
 890  0
 		public AttachmentFile(String name, URL url) {
 891  0
 			this.name = name;
 892  0
 			this.url = url;
 893  0
 		}
 894  
 
 895  
 		/**
 896  
 		 * źÉÕ¥Õ¥¡¥¤¥?¤ÎDataSource¥¤¥ó¥¹¥¿¥ó¥¹¤òÀ¸À®¤·¤ÆÊÖ¤·¤Þ¤¹¡£
 897  
 		 * 
 898  
 		 * @return źÉÕ¥Õ¥¡¥¤¥?¤ÎDataSource¥¤¥ó¥¹¥¿¥ó¥¹
 899  
 		 */
 900  
 		public DataSource getDataSource() {
 901  0
 			if (file != null) {
 902  0
 				return new FileDataSource(file);
 903  
 			}
 904  
 
 905  0
 			if (url != null) {
 906  0
 				return new URLDataSource(url);
 907  
 			}
 908  
 
 909  
 			// InputStream¤«¤éDataSource¤òÀ¸À®
 910  0
 			String contentType = FileTypeMap.getDefaultFileTypeMap().getContentType(name);
 911  0
 			return new ByteArrayDataSource(is, contentType);
 912  
 		}
 913  
 
 914  
 		/**
 915  
 		 * źÉÕ¥Õ¥¡¥¤¥?̾¤òÊÖ¤·¤Þ¤¹¡£
 916  
 		 * 
 917  
 		 * @return źÉÕ¥Õ¥¡¥¤¥?̾
 918  
 		 */
 919  
 		public String getName() {
 920  0
 			return name;
 921  
 		}
 922  
 
 923  
 		/**
 924  
 		 * @return ¥»¥Ã¥È¤µ¤?¤¿¥Õ¥¡¥¤¥?¡£¤Þ¤¿¤Ïnull¡£
 925  
 		 */
 926  
 		public File getFile() {
 927  0
 			return file;
 928  
 		}
 929  
 
 930  
 		/**
 931  
 		 * @return ¥»¥Ã¥È¤µ¤?¤¿InputStream¡£¤Þ¤¿¤Ïnull¡£
 932  
 		 */
 933  
 		public InputStream getInputStream() {
 934  0
 			return is;
 935  
 		}
 936  
 
 937  
 		/**
 938  
 		 * @return ¥»¥Ã¥È¤µ¤?¤¿URL¡£¤Þ¤¿¤Ïnull¡£
 939  
 		 */
 940  
 		public URL getUrl() {
 941  0
 			return url;
 942  
 		}
 943  
 	}
 944  
 
 945  
 	/**
 946  
 	 * ¥á¡¼¥?¤Î½ÅÍ×ÅÙ¡£Ä?¿ô¤Î¤ß¤òÄ?µÁ¡£
 947  
 	 * 
 948  
 	 * @author Tomohiro Otsuka
 949  
 	 * @version $Id: Mail.java,v 1.10.2.5 2005/01/23 10:39:11 otsuka Exp $
 950  
 	 */
 951  
 	public static class Importance {
 952  
 
 953  
 		/** ½ÅÍ×ÅÙ¡Ö¹â¡× */
 954  
 		public static final String HIGH = "high";
 955  
 
 956  
 		/** ½ÅÍ×ÅÙ¡ÖÃæ¡× */
 957  
 		public static final String NORMAL = "normal";
 958  
 
 959  
 		/** ½ÅÍ×ÅÙ¡ÖÄã¡× */
 960  
 		public static final String LOW = "low";
 961  
 
 962  
 	}
 963  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.