1 package com.ozacc.mail;
2
3 import java.io.UnsupportedEncodingException;
4 import java.util.ArrayList;
5 import java.util.Collections;
6 import java.util.HashMap;
7 import java.util.Iterator;
8 import java.util.List;
9 import java.util.Map;
10
11 import javax.mail.internet.AddressException;
12 import javax.mail.internet.InternetAddress;
13
14 import com.ozacc.mail.impl.Cp932;
15
16 /***
17 * ¥á¡¼¥?¡£
18 *
19 * @since 1.0
20 * @author Tomohiro Otsuka
21 * @version $Id: Mail.java,v 1.7 2004/09/14 00:04:57 otsuka Exp $
22 */
23 public class Mail {
24
25 /*** <code>ISO-2022-JP</code> */
26 public static final String JIS_CHARSET = "ISO-2022-JP";
27
28 public static final String DOCTYPE_PUBLIC = "-//OZACC//DTD MAIL//EN";
29
30 public static final String DOCTYPE_SYSTEM = "http://www.ozacc.com/library/dtd/ozacc-mail.dtd";
31
32 private String charset = JIS_CHARSET;
33
34 private String text;
35
36 private InternetAddress from;
37
38 private String subject;
39
40 private List to;
41
42 private List cc;
43
44 private List bcc;
45
46 private InternetAddress returnPath;
47
48 private InternetAddress replyTo;
49
50 private String importance;
51
52 private Map xHeaders;
53
54 /***
55 * ¥³¥ó¥¹¥È¥é¥¯¥¿¡£
56 */
57 public Mail() {}
58
59 /***
60 * ¥³¥ó¥¹¥È¥é¥¯¥¿¡£
61 * °¸Àè¤äº¹½Ð¿Í¤Î̾Á°¤ò¥¨¥ó¥³¡¼¥É¤¹¤?»?¤Ë»ÈÍѤ¹¤?ʸ»ú¥³¡¼¥É¤ò»ØÄꤷ¤Þ¤¹¡£
62 * ¥Ç¥Õ¥©¥?¥È¤Ï<code>ISO-2022-JP</code>¤Ç¤¹¡£
63 * <p>
64 * Æ?Ëܸ?´Ä¶¤ÇÍøÍѤ¹¤?¾?¹ç¤ÏÄ̾?Êѹ¹¤¹¤?ɬÍפϤ¢¤ê¤Þ¤»¤ó¡£
65 *
66 * @param charset ¥¨¥ó¥³¡¼¥É¤Ë»ÈÍѤ¹¤?ʸ»ú¥³¡¼¥É
67 */
68 public Mail(String charset) {
69 this();
70 this.charset = charset;
71 }
72
73 /***
74 * ¥³¥Ô¡¼¥³¥ó¥¹¥È¥é¥¯¥¿¡£
75 *
76 * @since 1.0.2
77 *
78 * @param original ¥³¥Ô¡¼¸µ¤ÎMail¥¤¥ó¥¹¥¿¥ó¥¹
79 */
80 public Mail(Mail original) {
81 this.bcc = original.bcc;
82 this.cc = original.cc;
83 this.charset = original.charset;
84 this.from = original.from;
85 this.importance = original.importance;
86 this.replyTo = original.replyTo;
87 this.returnPath = original.returnPath;
88 this.subject = original.subject;
89 this.text = original.text;
90 this.to = original.to;
91 this.xHeaders = original.xHeaders;
92 }
93
94 /***
95 * ¥¨¥ó¥³¡¼¥É¤Ë»ÈÍѤ¹¤?ʸ»ú¥³¡¼¥É¤òÊÖ¤·¤Þ¤¹¡£
96 *
97 * @return ¥¨¥ó¥³¡¼¥É¤Ë»ÈÍѤ¹¤?ʸ»ú¥³¡¼¥É
98 */
99 public String getCharset() {
100 return charset;
101 }
102
103 /***
104 * ¥á¡¼¥?¤Î½ÅÍ×ÅÙ¤ò¥»¥Ã¥È¤·¤Þ¤¹¡£
105 * °ú¿ô¤Ç»ØÄ?²Äǽ¤ÊÃͤϡÖhigh¡×¡¢¡Önormal¡×¡¢¡Ölow¡×¤Î¤¤¤º¤?¤«¤Ç¤¹¡£
106 *
107 * @param importance ¥á¡¼¥?¤Î½ÅÍ×ÅÙ¡£¡Öhigh¡×¡¢¡Önormal¡×¡¢¡Ölow¡×¤Î¤¤¤º¤?¤«¡£
108 * @throws IllegalArgumentException »ØÄ?²Äǽ¤ÊÃͰʳ°¤¬»ØÄꤵ¤?¤¿¾?¹?
109 *
110 * @see Mail.Importance
111 */
112 public void setImportance(String importance) throws IllegalArgumentException {
113 if ("high".equals(importance) || "normal".equals(importance) || "low".equals(importance)) {
114 this.importance = importance;
115 } else {
116 throw new IllegalArgumentException("'" + importance + "'¤Ï¡¢¥á¡¼¥?½ÅÍ×Å٤ˤϻØÄê¤Ç¤¤Ê¤¤ÃͤǤ¹¡£");
117 }
118 }
119
120 /***
121 * ¥á¡¼¥?¤Î½ÅÍ×ÅÙ¤òÊÖ¤·¤Þ¤¹¡£
122 * ÃͤϡÖhigh¡×¡¢¡Önormal¡×¡¢¡Ölow¡×¤Î¤¤¤º¤?¤«¤Ç¤¹¡£
123 *
124 * @return ¥á¡¼¥?¤Î½ÅÍ×ÅÙ¡£¡Öhigh¡×¡¢¡Önormal¡×¡¢¡Ölow¡×¤Î¤¤¤º¤?¤«¡£
125 */
126 public String getImportance() {
127 return importance;
128 }
129
130 /***
131 * ¥á¡¼¥?¤ÎÁ÷¿®À襢¥É¥?¥¹¤òÄɲä·¤Þ¤¹¡£
132 *
133 * @param address Á÷¿®À襢¥É¥?¥¹
134 */
135 public void addTo(InternetAddress address) {
136 if (to == null) {
137 to = new ArrayList();
138 }
139 to.add(address);
140 }
141
142 /***
143 * ¥á¡¼¥?¤ÎÁ÷¿®À襢¥É¥?¥¹¤òÄɲä·¤Þ¤¹¡£
144 *
145 * @param email Á÷¿®À襢¥É¥?¥¹
146 * @throws IllegalArgumentException ÉÔÀµ¤Ê¥Õ¥©¡¼¥Þ¥Ã¥È¤Î¥¢¥É¥?¥¹¤¬»ØÄꤵ¤?¤¿¾?¹?
147 */
148 public void addTo(String email) throws IllegalArgumentException {
149 try {
150 addTo(new InternetAddress(email));
151 } catch (AddressException e) {
152 throw new IllegalArgumentException(e.getMessage());
153 }
154 }
155
156 /***
157 * ¥á¡¼¥?¤ÎÁ÷¿®Àè̾¤È¥¢¥É¥?¥¹¤òÄɲä·¤Þ¤¹¡£
158 * ̾Á°¤ÏJIS_CHARSET¤Ç¥¨¥ó¥³¡¼¥É¤µ¤?¤Þ¤¹¡£
159 *
160 * @param email Á÷¿®À襢¥É¥?¥¹
161 * @param name Á÷¿®Àè̾
162 * @throws IllegalArgumentException ÉÔÀµ¤Ê¥Õ¥©¡¼¥Þ¥Ã¥È¤Î¥¢¥É¥?¥¹¤¬»ØÄꤵ¤?¤¿¾?¹?
163 */
164 public void addTo(String email, String name) throws IllegalArgumentException {
165 if (charset.equals(JIS_CHARSET)) {
166 name = Cp932.toJIS(name);
167 }
168 try {
169 addTo(new InternetAddress(email, name, charset));
170 } catch (UnsupportedEncodingException e) {
171 throw new IllegalArgumentException(e.getMessage());
172 }
173 }
174
175 /***
176 * ¥á¡¼¥?¤ÎÁ÷¿®À襢¥É¥?¥¹¤ÎÇÛÎó¤òÊÖ¤·¤Þ¤¹¡£
177 * Á÷¿®À襢¥É¥?¥¹¤¬°?·?¤â¥»¥Ã¥È¤µ¤?¤Æ¤¤¤Ê¤¤¤È¤¤Ï¶õ¤ÎÇÛÎó¤òÊÖ¤·¤Þ¤¹¡£
178 *
179 * @return Á÷¿®À襢¥É¥?¥¹¤ÎÇÛÎ?
180 */
181 public InternetAddress[] getTo() {
182 if (to == null) {
183 return new InternetAddress[0];
184 }
185 return (InternetAddress[])to.toArray(new InternetAddress[to.size()]);
186 }
187
188 /***
189 * CC¥¢¥É¥?¥¹¤òÄɲä·¤Þ¤¹¡£
190 *
191 * @param address CC¤Î¥¢¥É¥?¥¹
192 */
193 public void addCc(InternetAddress address) {
194 if (cc == null) {
195 cc = new ArrayList();
196 }
197 cc.add(address);
198 }
199
200 /***
201 * CC¥¢¥É¥?¥¹¤òÄɲä·¤Þ¤¹¡£
202 *
203 * @param email CC¤Î¥¢¥É¥?¥¹
204 * @throws IllegalArgumentException ÉÔÀµ¤Ê¥Õ¥©¡¼¥Þ¥Ã¥È¤Î¥¢¥É¥?¥¹¤¬»ØÄꤵ¤?¤¿¾?¹?
205 */
206 public void addCc(String email) throws IllegalArgumentException {
207 try {
208 addCc(new InternetAddress(email));
209 } catch (AddressException e) {
210 throw new IllegalArgumentException(e.getMessage());
211 }
212 }
213
214 /***
215 * CC¤Î°¸Ì¾¤È¥¢¥É¥?¥¹¤òÄɲä·¤Þ¤¹¡£
216 * ̾Á°¤ÏJIS_CHARSET¤Ç¥¨¥ó¥³¡¼¥É¤µ¤?¤Þ¤¹¡£
217 *
218 * @param email CC¤Î¥¢¥É¥?¥¹
219 * @param name CC¤Î°¸Ì¾
220 * @throws IllegalArgumentException ÉÔÀµ¤Ê¥Õ¥©¡¼¥Þ¥Ã¥È¤Î¥¢¥É¥?¥¹¤¬»ØÄꤵ¤?¤¿¾?¹?
221 */
222 public void addCc(String email, String name) throws IllegalArgumentException {
223 if (charset.equals(JIS_CHARSET)) {
224 name = Cp932.toJIS(name);
225 }
226 try {
227 addCc(new InternetAddress(email, name, charset));
228 } catch (UnsupportedEncodingException e) {
229 throw new IllegalArgumentException(e.getMessage());
230 }
231 }
232
233 /***
234 * ¥á¡¼¥?¤ÎCC¥¢¥É¥?¥¹ÇÛÎó¤òÊÖ¤·¤Þ¤¹¡£
235 * CC¥¢¥É¥?¥¹¤¬°?·?¤â¥»¥Ã¥È¤µ¤?¤Æ¤¤¤Ê¤¤¤È¤¤Ï¶õ¤ÎÇÛÎó¤òÊÖ¤·¤Þ¤¹¡£
236 *
237 * @return CC¥¢¥É¥?¥¹¤ÎÇÛÎ?
238 */
239 public InternetAddress[] getCc() {
240 if (cc == null) {
241 return new InternetAddress[0];
242 }
243 return (InternetAddress[])cc.toArray(new InternetAddress[cc.size()]);
244 }
245
246 /***
247 * BCC¥¢¥É¥?¥¹¤òÄɲä·¤Þ¤¹¡£
248 *
249 * @param address BCC¤Î¥¢¥É¥?¥¹
250 */
251 public void addBcc(InternetAddress address) {
252 if (bcc == null) {
253 bcc = new ArrayList();
254 }
255 bcc.add(address);
256 }
257
258 /***
259 * BCC¥¢¥É¥?¥¹¤òÄɲä·¤Þ¤¹¡£
260 *
261 * @param email BCC¤Î¥¢¥É¥?¥¹
262 * @throws IllegalArgumentException ÉÔÀµ¤Ê¥Õ¥©¡¼¥Þ¥Ã¥È¤Î¥¢¥É¥?¥¹¤¬»ØÄꤵ¤?¤¿¾?¹?
263 */
264 public void addBcc(String email) throws IllegalArgumentException {
265 try {
266 addBcc(new InternetAddress(email));
267 } catch (AddressException e) {
268 throw new IllegalArgumentException(e.getMessage());
269 }
270 }
271
272 /***
273 * ¥á¡¼¥?¤ÎBCC¥¢¥É¥?¥¹¤ÎÇÛÎó¤òÊÖ¤·¤Þ¤¹¡£
274 * BCC¥¢¥É¥?¥¹¤¬°?·?¤â¥»¥Ã¥È¤µ¤?¤Æ¤¤¤Ê¤¤¤È¤¤Ï¶õ¤ÎÇÛÎó¤òÊÖ¤·¤Þ¤¹¡£
275 *
276 * @return BCC¥¢¥É¥?¥¹¤ÎÇÛÎ?
277 */
278 public InternetAddress[] getBcc() {
279 if (bcc == null) {
280 return new InternetAddress[0];
281 }
282 return (InternetAddress[])bcc.toArray(new InternetAddress[bcc.size()]);
283 }
284
285 /***
286 * ¥á¡¼¥?¤Îº¹½Ð¿Í¥¢¥É¥?¥¹¤ò¥»¥Ã¥È¤·¤Þ¤¹¡£
287 *
288 * @param address º¹½Ð¿Í¥¢¥É¥?¥¹
289 */
290 public void setFrom(InternetAddress address) {
291 from = address;
292 }
293
294 /***
295 * ¥á¡¼¥?¤Îº¹½Ð¿Í¥¢¥É¥?¥¹¤ò¥»¥Ã¥È¤·¤Þ¤¹¡£
296 *
297 * @param email º¹½Ð¿Í¥¢¥É¥?¥¹
298 * @throws IllegalArgumentException ÉÔÀµ¤Ê¥Õ¥©¡¼¥Þ¥Ã¥È¤Î¥¢¥É¥?¥¹¤¬»ØÄꤵ¤?¤¿¾?¹?
299 */
300 public void setFrom(String email) throws IllegalArgumentException {
301 try {
302 setFrom(new InternetAddress(email));
303 } catch (AddressException e) {
304 throw new IllegalArgumentException(e.getMessage());
305 }
306 }
307
308 /***
309 * ¥á¡¼¥?¤Îº¹½Ð¿Í̾¤È¥¢¥É¥?¥¹¤ò¥»¥Ã¥È¤·¤Þ¤¹¡£
310 * ̾Á°¤ÏJIS_CHARSET¤Ç¥¨¥ó¥³¡¼¥É¤µ¤?¤Þ¤¹¡£
311 *
312 * @param email º¹½Ð¿Í¥¢¥É¥?¥¹
313 * @param name º¹½Ð¿Í̾
314 * @throws IllegalArgumentException ÉÔÀµ¤Ê¥Õ¥©¡¼¥Þ¥Ã¥È¤Î¥¢¥É¥?¥¹¤¬»ØÄꤵ¤?¤¿¾?¹?
315 */
316 public void setFrom(String email, String name) throws IllegalArgumentException {
317 if (charset.equals(JIS_CHARSET)) {
318 name = Cp932.toJIS(name);
319 }
320 try {
321 setFrom(new InternetAddress(email, name, charset));
322 } catch (UnsupportedEncodingException e) {
323 throw new IllegalArgumentException(e.getMessage());
324 }
325 }
326
327 /***
328 * ¥á¡¼¥?¤Îº¹½Ð¿Í¥¢¥É¥?¥¹¤òÊÖ¤·¤Þ¤¹¡£¥»¥Ã¥È¤µ¤?¤Æ¤¤¤Ê¤¤¾?¹ç¤Ïnull¤òÊÖ¤·¤Þ¤¹¡£
329 *
330 * @return ¥á¡¼¥?¤Îº¹½Ð¿Í¥¢¥É¥?¥¹
331 */
332 public InternetAddress getFrom() {
333 return from;
334 }
335
336 /***
337 * Return-Path¥¢¥É¥?¥¹¤ò¥»¥Ã¥È¤·¤Þ¤¹¡£
338 *
339 * @param address Return-Path¥¢¥É¥?¥¹
340 */
341 public void setReturnPath(InternetAddress address) {
342 returnPath = address;
343 }
344
345 /***
346 * Return-Path¥¢¥É¥?¥¹¤ò¥»¥Ã¥È¤·¤Þ¤¹¡£
347 *
348 * @param email Return-Path¥¢¥É¥?¥¹
349 * @throws IllegalArgumentException ÉÔÀµ¤Ê¥Õ¥©¡¼¥Þ¥Ã¥È¤Î¥¢¥É¥?¥¹¤¬»ØÄꤵ¤?¤¿¾?¹?
350 */
351 public void setReturnPath(String email) throws IllegalArgumentException {
352 try {
353 setReturnPath(new InternetAddress(email));
354 } catch (AddressException e) {
355 throw new IllegalArgumentException(e.getMessage());
356 }
357 }
358
359 /***
360 * Return-Path¥¢¥É¥?¥¹¤òÊÖ¤·¤Þ¤¹¡£
361 *
362 * @return Return-Path¥¢¥É¥?¥¹
363 */
364 public InternetAddress getReturnPath() {
365 return returnPath;
366 }
367
368 /***
369 * ÊÖ¿®À襢¥É¥?¥¹¤ò¥»¥Ã¥È¤·¤Þ¤¹¡£
370 *
371 * @param address ÊÖ¿®À襢¥É¥?¥¹
372 */
373 public void setReplyTo(InternetAddress address) {
374 replyTo = address;
375 }
376
377 /***
378 * ÊÖ¿®À襢¥É¥?¥¹¤ò¥»¥Ã¥È¤·¤Þ¤¹¡£
379 *
380 * @param email ÊÖ¿®À襢¥É¥?¥¹
381 * @throws IllegalArgumentException ÉÔÀµ¤Ê¥Õ¥©¡¼¥Þ¥Ã¥È¤Î¥¢¥É¥?¥¹¤¬»ØÄꤵ¤?¤¿¾?¹?
382 */
383 public void setReplyTo(String email) throws IllegalArgumentException {
384 try {
385 setReplyTo(new InternetAddress(email));
386 } catch (AddressException e) {
387 throw new IllegalArgumentException(e.getMessage());
388 }
389 }
390
391 /***
392 * ¥á¡¼¥?¤ÎÊÖ¿®À襢¥É¥?¥¹¤òÊÖ¤·¤Þ¤¹¡£¥»¥Ã¥È¤µ¤?¤Æ¤¤¤Ê¤¤¾?¹ç¤Ïnull¤òÊÖ¤·¤Þ¤¹¡£
393 *
394 * @return ÊÖ¿®À襢¥É¥?¥¹
395 */
396 public InternetAddress getReplyTo() {
397 return replyTo;
398 }
399
400 /***
401 * ¥á¡¼¥?¤Î·?̾¤òÊÖ¤·¤Þ¤¹¡£¥»¥Ã¥È¤µ¤?¤Æ¤¤¤Ê¤¤¾?¹ç¤Ï¶õʸ»úÎó¤òÊÖ¤·¤Þ¤¹¡£
402 *
403 * @return ¥á¡¼¥?¤Î·?̾
404 */
405 public String getSubject() {
406 if (subject == null) {
407 return "";
408 }
409 return subject;
410 }
411
412 /***
413 * ¥á¡¼¥?¤Î·?̾¤ò¥»¥Ã¥È¤·¤Þ¤¹¡£
414 *
415 * @param subject ¥á¡¼¥?¤Î·?̾
416 */
417 public void setSubject(String subject) {
418 this.subject = subject;
419 }
420
421 /***
422 * ¥á¡¼¥?ËÜʸ¤òÊÖ¤·¤Þ¤¹¡£
423 * ËÜʸ¥»¥Ã¥È¤µ¤?¤Æ¤¤¤Ê¤¤¾?¹ç¤Ï¶õʸ»úÎó¤òÊÖ¤·¤Þ¤¹¡£
424 *
425 * @return ¥á¡¼¥?ËÜʸ
426 */
427 public String getText() {
428 if (text == null) {
429 return "";
430 }
431 return text;
432 }
433
434 /***
435 * ¥á¡¼¥?ËÜʸ¤ò¥»¥Ã¥È¤·¤Þ¤¹¡£
436 *
437 * @param text ¥á¡¼¥?ËÜʸ
438 */
439 public void setText(String text) {
440 this.text = text;
441 }
442
443 /***
444 * ¥á¡¼¥?¥Ø¥Ã¥À¤ËǤ°Õ¤Î¥Ø¥Ã¥À¤òÄɲä·¤Þ¤¹¡£
445 * Ǥ°Õ¥Ø¥Ã¥À¤Ï¡ÖX-key: value¡×¤Î¥Õ¥©¡¼¥Þ¥Ã¥È¤Ç¥á¡¼¥?¥Ø¥Ã¥À¤ËÁȤ߹?¤Þ¤?¤Þ¤¹¡£
446 *
447 * @param key Ǥ°Õ¥Ø¥Ã¥À̾¡£Æ¬¤¬"X-"¤Ç»Ï¤Þ¤Ã¤Æ¤¤¤Ê¤±¤?¤Ð¡¢¼«Æ°Åª¤ËÉÕÍ¿¤µ¤?¤Þ¤¹¡£
448 * @param value Ǥ°Õ¥Ø¥Ã¥À¤ÎÃÍ
449 */
450 public void addXHeader(String key, String value) {
451 if (xHeaders == null) {
452 xHeaders = new HashMap();
453 }
454 if (key.startsWith("X-")) {
455 xHeaders.put(key, value);
456 } else {
457 xHeaders.put("X-" + key, value);
458 }
459 }
460
461 /***
462 * ¥á¡¼¥?¤ÎǤ°Õ¥Ø¥Ã¥À̾¤ÈÃͤÎMap¥¤¥ó¥¹¥¿¥ó¥¹¤òÊÖ¤·¤Þ¤¹¡£
463 * Ǥ°Õ¥Ø¥Ã¥À¤¬°?·?¤â¥»¥Ã¥È¤µ¤?¤Æ¤¤¤Ê¤¤¤È¤¤Ïnull¤òÊÖ¤·¤Þ¤¹¡£
464 * <p>
465 * ¤³¤ÎMap¥¤¥ó¥¹¥¿¥ó¥¹¤Ø¤Î½¤Àµ¤Ï¤Ç¤¤Þ¤»¤ó¡£(unmodifiableMap¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£)
466 *
467 * @return ¥á¡¼¥?¤ÎǤ°Õ¥Ø¥Ã¥À̾¤ÈÃͤÎMap¥¤¥ó¥¹¥¿¥ó¥¹¡£¤Þ¤¿¤Ïnull¡£
468 */
469 public Map getXHeaders() {
470 if (xHeaders == null) {
471 return null;
472 }
473 return Collections.unmodifiableMap(xHeaders);
474 }
475
476 /***
477 * ¥á¡¼¥?ÆâÍÆ¤ò½ÐÎϤ·¤Þ¤¹¡£<br>
478 * ¥á¡¼¥?¤Î¥½¡¼¥¹¤Ë»÷¤¿¥Õ¥©¡¼¥Þ¥Ã¥È¤Ç½ÐÎϤµ¤?¤Þ¤¹¡£
479 *
480 * @see java.lang.Object#toString()
481 */
482 public String toString() {
483 StringBuffer buf = new StringBuffer(1000);
484 buf.append("Mail\n");
485 buf.append("Return-Path: ").append(returnPath).append("\n");
486 buf.append("From: ").append(from != null ? from.toUnicodeString() : null).append("\n");
487 buf.append("To: ").append(arrayToCommaDelimitedString(to)).append("\n");
488 buf.append("Cc: ").append(arrayToCommaDelimitedString(cc)).append("\n");
489 buf.append("Bcc: ").append(arrayToCommaDelimitedString(bcc)).append("\n");
490 buf.append("Subject: ").append(subject).append("\n");
491
492 if (xHeaders != null) {
493 for (Iterator itr = xHeaders.keySet().iterator(); itr.hasNext();) {
494 String header = (String)itr.next();
495 String value = (String)xHeaders.get(header);
496 buf.append(header).append(": ").append(value).append("\n");
497 }
498 }
499
500 buf.append("\n");
501 buf.append(text);
502
503 return buf.toString();
504 }
505
506 /***
507 * @param list
508 * @return
509 */
510 private String arrayToCommaDelimitedString(List list) {
511 if (list == null) {
512 return "null";
513 } else {
514 StringBuffer sb = new StringBuffer();
515 for (int i = 0, num = list.size(); i < num; i++) {
516 if (i > 0) {
517 sb.append(", ");
518 }
519 sb.append(((InternetAddress)list.get(i)).toUnicodeString());
520 }
521 return sb.toString();
522 }
523 }
524
525 /***
526 * ¥»¥Ã¥È¤µ¤?¤Æ¤¤¤?Á÷¿®À襢¥É¥?¥¹(To¥¢¥É¥?¥¹)¤òÁ´¤Æ¥¯¥?¥¢¤·¤Þ¤¹¡£
527 *
528 * @since 1.0.2
529 */
530 public void clearTo() {
531 to = null;
532 }
533
534 /***
535 * ¥»¥Ã¥È¤µ¤?¤Æ¤¤¤?CC¥¢¥É¥?¥¹¤òÁ´¤Æ¥¯¥?¥¢¤·¤Þ¤¹¡£
536 *
537 * @since 1.0.2
538 */
539 public void clearCc() {
540 cc = null;
541 }
542
543 /***
544 * ¥»¥Ã¥È¤µ¤?¤Æ¤¤¤?BCC¥¢¥É¥?¥¹¤òÁ´¤Æ¥¯¥?¥¢¤·¤Þ¤¹¡£
545 *
546 * @since 1.0.2
547 */
548 public void clearBcc() {
549 bcc = null;
550 }
551
552 /***
553 * ¥á¡¼¥?¤Î½ÅÍ×ÅÙ¡£Ä?¿ô¤Î¤ß¤òÄ?µÁ¡£
554 *
555 * @author Tomohiro Otsuka
556 * @version $Id: Mail.java,v 1.7 2004/09/14 00:04:57 otsuka Exp $
557 */
558 public static class Importance {
559
560 /*** ½ÅÍ×ÅÙ¡Ö¹â¡× */
561 public static final String HIGH = "high";
562
563 /*** ½ÅÍ×ÅÙ¡ÖÃæ¡× */
564 public static final String NORMAL = "normal";
565
566 /*** ½ÅÍ×ÅÙ¡ÖÄã¡× */
567 public static final String LOW = "low";
568
569 }
570 }