1 package com.ozacc.mail.mock;
2
3 import java.io.UnsupportedEncodingException;
4 import java.util.ArrayList;
5 import java.util.List;
6 import java.util.Properties;
7
8 import javax.mail.MessagingException;
9 import javax.mail.Session;
10 import javax.mail.internet.InternetAddress;
11 import javax.mail.internet.MimeMessage;
12
13 import com.ozacc.mail.Mail;
14 import com.ozacc.mail.MailBuildException;
15 import com.ozacc.mail.MailException;
16 import com.ozacc.mail.SendMail;
17 import com.ozacc.mail.impl.MimeMessageBuilder;
18
19 /***
20 * SendMailImpl¥¯¥é¥¹¤ÎMock¡£<br>
21 * ¼Â¸¤¹¤?SMTP¥µ¡¼¥Ð¤òÀßÄꤷ¤Æ¤â¡¢¼ÂºÝ¤Ë¤ÏÁ÷¿®¤µ¤?¤Þ¤»¤ó¡£
22 * ¥Ç¥Ð¥Ã¥°¥â¡¼¥É¤ò͸ú¤Ë¤¹¤?¤È¡¢¥á¡¼¥?¤òÁ÷¿®¤¹¤?¥¿¥¤¥ß¥ó¥°¤Ç¥³¥ó¥½¡¼¥?¤ËÁ÷¿®¥á¡¼¥?ÆâÍÆ¤¬½ÐÎϤµ¤?¤Þ¤¹¡£
23 * <p>
24 * Mail¥¤¥ó¥¹¥¿¥ó¥¹¤? addExpectedMail() ¤Ë¥»¥Ã¥È¤· verify() ¥á¥½¥Ã¥É¤ò¼Â¹Ô¤¹¤?¤È¡¢send() ¤µ¤?¤¿Mail¥¤¥ó¥¹¥¿¥ó¥¹¤ÈÁ´¤Æ¤Î¥×¥úÁѥƥ£(XHeader¤ò½?¤¯)¤¬°?Ãפ·¤Ê¤±¤?¤ÐAssertionFailedException¤¬¥¹¥ú½¼¤µ¤?¤Þ¤¹¡£
25 * <p>
26 * Î㤨¤Ð¡¢send() ¤µ¤?¤¿Mail¥¤¥ó¥¹¥¿¥ó¥¹¤ÎFrom¥¢¥É¥?¥¹¤È·?̾¤À¤±¥Á¥§¥Ã¥¯¤·¡¢¤½¤Î¾¤Î¥×¥úÁѥƥ£¤Ï¥Á¥§¥Ã¥¯¤·¤¿¤¯¤Ê¤¤¾?¹ç¤Ï¡¢MockMail¥¤¥ó¥¹¥¿¥ó¥¹¤ò»ÈÍѤ·¤Þ¤¹¡£
27 * <pre>Mail sentMail = new Mail();
28 *sentMail.setFrom("from@example.com");
29 *sentMail.setSubject("·?̾");
30 *sentMail.addTo("to@example.com");
31 *sentMail.setText("ưŪÀ¸À®¤µ¤?¤?ËÜʸ");
32 *
33 *Mail expectedMail = new Mail();
34 *expectedMail.setFrom("from@example.com");
35 *expectedMail.setSubject("·?̾");
36 *
37 *MockMail mockMail = new MockMail();
38 *mockMail.setFrom("from@example.com");
39 *mockMail.setSubject("·?̾");
40 *
41 *MockSendMail sendMail = new MockSendMail();
42 *sendMail.addExpectedMail(expectedMail);
43 *sendMail.send(sentMail);
44 *sendMail.verify(); // ¼ºÇÔ AssertionFailedException
45 *
46 *sendMail = new MockSendMail();
47 *sendMail.addExpectedMail(mockMail);
48 *sendMail.send(sentMail);
49 *sendMail.verify(); // À®¸?</pre>
50 * <p>
51 * <strong>Ã?:</strong> źÉÕ¥Õ¥¡¥¤¥?¤ÏÈæ³ÓÂоݤˤʤê¤Þ¤»¤ó¡£
52 *
53 * @since 1.0
54 * @author Tomohiro Otsuka
55 * @version $Id: MockSendMail.java,v 1.12 2004/10/31 04:34:08 otsuka Exp $
56 */
57 public class MockSendMail implements SendMail {
58
59 /*** ¥Ç¥Õ¥©¥?¥È¤Î¥×¥úÁÈ¥³¥?¡£¡Ösmtp¡× */
60 public static final String DEFAULT_PROTOCOL = "smtp";
61
62 /*** ¥Ç¥Õ¥©¥?¥È¤Î¥Ý¡¼¥È¡£¡Ö-1¡× */
63 public static final int DEFAULT_PORT = -1;
64
65 /*** ¥Ç¥Õ¥©¥?¥È¤ÎSMTP¥µ¡¼¥Ð¡£¡Ölocalhost¡× */
66 public static final String DEFAULT_HOST = "localhost";
67
68 /*** ISO-2022-JP */
69 public static final String JIS_CHARSET = "ISO-2022-JP";
70
71 private static final String RETURN_PATH_KEY = "mail.smtp.from";
72
73 private String protocol = DEFAULT_PROTOCOL;
74
75 private String host = DEFAULT_HOST;
76
77 private int port = DEFAULT_PORT;
78
79 private String username;
80
81 private String password;
82
83 private String charset = JIS_CHARSET;
84
85 private String returnPath;
86
87 private List sentMails;
88
89 private List mimeMessages;
90
91 private List expectedMails;
92
93 private boolean debug;
94
95 /***
96 * ¥³¥ó¥¹¥È¥é¥¯¥¿¡£
97 */
98 public MockSendMail() {
99 super();
100 initialize();
101 }
102
103 /***
104 * MockSendMail¥¤¥ó¥¹¥¿¥ó¥¹¤ò½é´?²½¤·¤Þ¤¹¡£
105 */
106 public void initialize() {
107 sentMails = new ArrayList();
108 expectedMails = new ArrayList();
109 mimeMessages = new ArrayList();
110 }
111
112 /***
113 * Á÷¿®¤µ¤?¤¿¥á¡¼¥?¤ÎMimeMessage¥¤¥ó¥¹¥¿¥ó¥¹¤òÊÖ¤·¤Þ¤¹¡£
114 * Á÷¿®½ç¤ÎÇÛÎó¤Ç¤¹¡£
115 *
116 * @return Á÷¿®¥á¡¼¥?¤ÎMimeMessage¥¤¥ó¥¹¥¿¥ó¥¹ÇÛÎ?
117 */
118 public MimeMessage[] getMimeMessages() {
119 return (MimeMessage[])mimeMessages.toArray(new MimeMessage[mimeMessages.size()]);
120 }
121
122 /***
123 * Á÷¿®¤µ¤?¤¿Mail¥¤¥ó¥¹¥¿¥ó¥¹¤òÊÖ¤·¤Þ¤¹¡£Á÷¿®½ç¤ÎÇÛÎó¤Ç¤¹¡£
124 *
125 * @return Á÷¿®¥á¡¼¥?¤ÎMail¥¤¥ó¥¹¥¿¥ó¥¹ÇÛÎ?
126 */
127 public Mail[] getSentMails() {
128 return (Mail[])sentMails.toArray(new Mail[sentMails.size()]);
129 }
130
131 /***
132 * ¥Ç¥Ð¥Ã¥°¥â¡¼¥É¤¬Í¸ú¤Ë¤Ê¤Ã¤Æ¤¤¤?¤«È½Äꤷ¤Þ¤¹¡£
133 *
134 * @return Returns ͸ú¤Ë¤Ê¤Ã¤Æ¤¤¤?¾?¹? true
135 */
136 public boolean isDebug() {
137 return debug;
138 }
139
140 /***
141 * ¥Ç¥Ð¥Ã¥°¥â¡¼¥É(¥³¥ó¥½¡¼¥?¤Ë¥úÁ°¤ò½ÐÎÏ)¤ò͸ú¤Ë¤·¤Þ¤¹¡£
142 * ¥Ç¥Õ¥©¥?¥È¤Ï̵¸ú¤Ç¤¹¡£
143 *
144 * @param debug ¥Ç¥Ð¥Ã¥°¥â¡¼¥É¤ò͸ú¤Ë¤¹¤?¾?¹? true
145 */
146 public void setDebug(boolean debug) {
147 this.debug = debug;
148 }
149
150 /***
151 * ¥Ç¥Ð¥Ã¥°¥â¡¼¥É¤¬Í¸ú¤Î¤È¤¡¢»ØÄꤵ¤?¤¿¥á¥Ã¥»¡¼¥¸¤ò¥³¥ó¥½¡¼¥?¤Ë½ÐÎϤ·¤Þ¤¹¡£
152 *
153 * @param message ¥³¥ó¥½¡¼¥?½ÐÎϤ¹¤?¥á¥Ã¥»¡¼¥¸
154 */
155 private void debug(String message) {
156 if (debug) {
157 System.out.println("[" + Thread.currentThread().getName() + "] DEBUG "
158 + getClass().getName() + " - " + message);
159 }
160 }
161
162 /***
163 *
164 * @param expectedMail
165 */
166 public void addExpectedMail(Mail expectedMail) {
167 expectedMails.add(expectedMail);
168 }
169
170 /***
171 *
172 * @param expectedMails
173 */
174 public void addExpectedMail(Mail[] expectedMails) {
175 for (int i = 0; i < expectedMails.length; i++) {
176 addExpectedMail(expectedMails[i]);
177 }
178 }
179
180 /***
181 *
182 * @throws AssertionFailedException
183 */
184 public void verify() throws AssertionFailedException {
185 debug("======================================================");
186 debug(" verify() ");
187 debug("======================================================");
188
189
190 int numOfExpectedMails = expectedMails.size();
191 int numOfSentMails = sentMails.size();
192 if (numOfExpectedMails != numOfSentMails) {
193 throw new AssertionFailedException("´?Âԥ᡼¥?¿?<" + numOfExpectedMails + ">¤ÈÁ÷¿®¥á¡¼¥?¿?<"
194 + numOfSentMails + ">¤¬°?Ãפ·¤Þ¤»¤ó¤Ç¤·¤¿¡£");
195 }
196
197 debug("´?Âԥ᡼¥?¿ô¤ÈÁ÷¿®¥á¡¼¥?¿ô¤Ï°?Ãפ·¤Þ¤·¤¿¡£[" + numOfExpectedMails + "ÄÌ]");
198
199
200 for (int i = 0; i < numOfExpectedMails; i++) {
201 Mail expected = (Mail)expectedMails.get(i);
202 Mail sent = (Mail)sentMails.get(i);
203 debug((i + 1) + "ÄÌÌܤΥÁ¥§¥Ã¥¯¤ò³«»Ï¤·¤Þ¤¹¡£("
204 + ((expected instanceof MockMail) ? "MockMail" : "Mail") + " - Mail)");
205 checkEquality(expected, sent, i + 1);
206 debug((i + 1) + "ÄÌÌܤδ?Âԥ᡼¥?¤ÈÁ÷¿®¥á¡¼¥?ÆâÍÆ¤Ï°?Ãפ·¤Þ¤·¤¿¡£");
207 }
208
209 debug("verify¥×¥úÁ»¥¹¤ÏÁ´¤ÆÀ®¸ù¤·¤Þ¤·¤¿¡£");
210 debug("======================================================");
211 }
212
213 /***
214 * @param expected
215 * @param sent
216 * @throws AssertionFailedException
217 */
218 public void checkEquality(Mail expected, Mail sent, int num) throws AssertionFailedException {
219 boolean mockMode = (expected instanceof MockMail);
220
221
222 if (expected.isMultipartMail()) {
223
224
225 if (!mockMode) {
226 if ((expected.getHtmlText() == null && sent.getHtmlText() != null)
227 || (expected.getHtmlText() != null && sent.getHtmlText() == null)
228 || (!expected.getHtmlText().equals(sent.getHtmlText()))) {
229 throwExceptioWithMessage("HTMLËÜʸ", expected.getHtmlText(), sent.getHtmlText(),
230 num);
231 }
232 } else if (mockMode && expected.getHtmlText() != null) {
233 if (!expected.getHtmlText().equals(sent.getHtmlText())) {
234 throwExceptioWithMessage("HTMLËÜʸ", expected.getHtmlText(), sent.getHtmlText(),
235 num);
236 }
237 }
238 }
239
240
241 if (!mockMode || (mockMode && expected.getReturnPath() != null)) {
242 if (expected.getReturnPath() != null && sent.getReturnPath() != null) {
243 if (!expected.getReturnPath().equals(sent.getReturnPath())) {
244 throwExceptioWithMessage("Return-Path¥¢¥É¥?¥¹", expected.getReturnPath()
245 .toUnicodeString(), sent.getReturnPath().toUnicodeString(), num);
246 }
247 } else if ((expected.getReturnPath() != null && sent.getReturnPath() == null)
248 || (expected.getReturnPath() == null && sent.getReturnPath() != null)) {
249 throw new AssertionFailedException();
250 }
251 }
252
253
254 if (!mockMode || (mockMode && expected.getFrom() != null)) {
255 if (expected.getFrom() != null && sent.getFrom() != null) {
256 if (!EqualityCheck.equals(expected.getFrom(), sent.getFrom())) {
257 throwExceptioWithMessage("From¥¢¥É¥?¥¹", expected.getFrom().toUnicodeString(), sent
258 .getFrom().toUnicodeString(), num);
259 }
260 } else if ((expected.getFrom() != null && sent.getFrom() == null)
261 || (expected.getFrom() == null && sent.getFrom() != null)) {
262 throw new AssertionFailedException();
263 }
264 }
265
266
267 InternetAddress[] expectedAddresses = expected.getTo();
268 InternetAddress[] sentAddresses = sent.getTo();
269 if (!mockMode || (mockMode && expectedAddresses.length > 0)) {
270 if (expectedAddresses.length != sentAddresses.length) {
271 throwExceptioWithMessage("To¥¢¥É¥?¥¹¿?", Integer.toString(expectedAddresses.length),
272 Integer.toString(sentAddresses.length), num);
273 }
274 for (int i = 0; i < expectedAddresses.length; i++) {
275 if (!EqualityCheck.equals(expectedAddresses[i], sentAddresses[i])) {
276 throwExceptioWithMessage("To¥¢¥É¥?¥¹", expectedAddresses[i].toUnicodeString(),
277 sentAddresses[i].toUnicodeString(), num);
278 }
279 }
280 }
281
282
283 expectedAddresses = expected.getCc();
284 sentAddresses = sent.getCc();
285 if (!mockMode || (mockMode && expectedAddresses.length > 0)) {
286 if (expectedAddresses.length != sentAddresses.length) {
287 throwExceptioWithMessage("Cc¥¢¥É¥?¥¹¿?", Integer.toString(expectedAddresses.length),
288 Integer.toString(sentAddresses.length), num);
289 }
290 for (int i = 0; i < expectedAddresses.length; i++) {
291 if (!EqualityCheck.equals(expectedAddresses[i], sentAddresses[i])) {
292 throwExceptioWithMessage("Cc¥¢¥É¥?¥¹", expectedAddresses[i].toUnicodeString(),
293 sentAddresses[i].toUnicodeString(), num);
294 }
295 }
296 }
297
298
299 expectedAddresses = expected.getBcc();
300 sentAddresses = sent.getBcc();
301 if (!mockMode || (mockMode && expectedAddresses.length > 0)) {
302 if (expectedAddresses.length != sentAddresses.length) {
303 throwExceptioWithMessage("Bcc¥¢¥É¥?¥¹¿?", Integer.toString(expectedAddresses.length),
304 Integer.toString(sentAddresses.length), num);
305 }
306 for (int i = 0; i < expectedAddresses.length; i++) {
307 if (!EqualityCheck.equals(expectedAddresses[i], sentAddresses[i])) {
308 throwExceptioWithMessage("Bcc¥¢¥É¥?¥¹", expectedAddresses[i].toUnicodeString(),
309 sentAddresses[i].toUnicodeString(), num);
310 }
311 }
312 }
313
314
315 if (!mockMode || (mockMode && expected.getReplyTo() != null)) {
316 if (expected.getReplyTo() != null && sent.getReplyTo() != null) {
317 if (!EqualityCheck.equals(expected.getReplyTo(), sent.getReplyTo())) {
318 throwExceptioWithMessage("ReplyTo¥¢¥É¥?¥¹",
319 expected.getReplyTo().toUnicodeString(), sent.getReplyTo()
320 .toUnicodeString(), num);
321 }
322 } else if ((expected.getReplyTo() != null && sent.getReplyTo() == null)
323 || (expected.getReplyTo() == null && sent.getReplyTo() != null)) {
324 throw new AssertionFailedException();
325 }
326 }
327
328
329 if (!mockMode || (mockMode && expected.getSubject().length() > 0)) {
330 if (!expected.getSubject().equals(sent.getSubject())) {
331 throwExceptioWithMessage("·?̾", expected.getSubject(), sent.getSubject(), num);
332 }
333 }
334
335
336 if (!mockMode || (mockMode && expected.getText().length() > 0)) {
337 if (!expected.getText().equals(sent.getText())) {
338 throwExceptioWithMessage("ËÜʸ", expected.getText(), sent.getText(), num);
339 }
340 }
341
342 }
343
344 /***
345 * °ú¿ô¤ÎÃͤò¼õ¤±¤Æ¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸¤òÀ¸À®¤·¡¢AssertionFailedError¤ò¥¹¥ú½¼¤·¤Þ¤¹¡£
346 *
347 * @param name °?Ãפ·¤Ê¤«¤Ã¤¿¹àÌÜ̾
348 * @param expectedValue ´?ÂÔÃÍ
349 * @param sentValue ¼ÂºÝÃÍ
350 * @param num NÈÖÌܤΥ᡼¥?
351 * @throws AssertionFailedException À¸À®¤µ¤?¤¿Îã³°
352 */
353 protected void throwExceptioWithMessage(String name, String expectedValue, String sentValue,
354 int num) throws AssertionFailedException {
355 String message = num + "ÈÖÌܤΥá¥Ã¥»¡¼¥¸¤Ç¡¢¡Ö" + name + "¡×¤¬°?Ãפ·¤Þ¤»¤ó¤Ç¤·¤¿¡£´?ÂÔÃÍ='" + expectedValue
356 + "', Á÷¿®ÃÍ='" + sentValue + "'";
357
358 debug(message);
359 debug("verify¥×¥úÁ»¥¹¤Ï¼ºÇÔ¤·¤Þ¤·¤¿¡£");
360 debug("******************************************************");
361
362 throw new AssertionFailedException(message);
363 }
364
365 /***
366 * @see com.ozacc.mail.SendMail#send(com.ozacc.mail.Mail)
367 */
368 public void send(Mail mail) throws MailException {
369 send(new Mail[] { mail });
370 }
371
372 /***
373 * @see com.ozacc.mail.SendMail#send(com.ozacc.mail.Mail[])
374 */
375 public void send(Mail[] mails) throws MailException {
376 debug("SMTP¥µ¡¼¥Ð[" + host + "]¤ËÀܳ¤¹¤?¥Õ¥ê¡£");
377 debug("SMTP¥µ¡¼¥Ð[" + host + "]¤ËÀܳ¤·¤¿¥Õ¥ê¡£");
378
379 Session session = Session.getInstance(new Properties());
380 for (int i = 0; i < mails.length; i++) {
381
382 Mail mail = mails[i];
383
384
385 MimeMessage message = new MimeMessage(session);
386 MimeMessageBuilder builder = new MimeMessageBuilder(message);
387 try {
388 builder.buildMimeMessage(mail);
389 } catch (UnsupportedEncodingException e) {
390 throw new MailBuildException("¥µ¥Ý¡¼¥È¤µ¤?¤Æ¤¤¤Ê¤¤Ê¸»ú¥³¡¼¥É¤¬»ØÄꤵ¤?¤Þ¤·¤¿¡£", e);
391 } catch (MessagingException e) {
392 throw new MailBuildException("MimeMessage¤ÎÀ¸À®¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£", e);
393 }
394 mimeMessages.add(message);
395
396 debug("¥á¡¼¥?¤òÁ÷¿®¤¹¤?¥Õ¥ê¡£");
397 sentMails.add(mail);
398 debug(mail.toString());
399 debug("¥á¡¼¥?¤òÁ÷¿®¤·¤¿¥Õ¥ê¡£");
400 }
401
402 debug("SMTP¥µ¡¼¥Ð[" + host + "]¤È¤ÎÀܳ¤òÀÚÃǤ¹¤?¥Õ¥ê¡£");
403 debug("SMTP¥µ¡¼¥Ð[" + host + "]¤È¤ÎÀܳ¤òÀÚÃǤ·¤¿¥Õ¥ê¡£");
404 }
405
406 /***
407 * @see com.ozacc.mail.SendMail#send(javax.mail.internet.MimeMessage)
408 */
409 public void send(MimeMessage mimeMessage) throws MailException {
410 throw new UnsupportedOperationException("¿½¤·Ìõ¤´¤¶¤¤¤Þ¤»¤ó¡£MockSendMail¤Ç¤Ï¡¢¤³¤Î¥á¥½¥Ã¥É¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Þ¤»¤ó¡£");
411 }
412
413 /***
414 * @see com.ozacc.mail.SendMail#send(javax.mail.internet.MimeMessage[])
415 */
416 public void send(MimeMessage[] mimeMessages) throws MailException {
417 throw new UnsupportedOperationException("¿½¤·Ìõ¤´¤¶¤¤¤Þ¤»¤ó¡£MockSendMail¤Ç¤Ï¡¢¤³¤Î¥á¥½¥Ã¥É¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Þ¤»¤ó¡£");
418 }
419
420 /***
421 * ¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤Ë»ÈÍѤ¹¤?ʸ»ú¥³¡¼¥É¤òÊÖ¤·¤Þ¤¹¡£
422 *
423 * @return ¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤Ë»ÈÍѤ¹¤?ʸ»ú¥³¡¼¥É
424 */
425 public String getCharset() {
426 return charset;
427 }
428
429 /***
430 * ¥á¡¼¥?¤Î·?̾¤äËÜʸ¤Î¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤Ë»ÈÍѤ¹¤?ʸ»ú¥³¡¼¥É¤ò»ØÄꤷ¤Þ¤¹¡£
431 * ¥Ç¥Õ¥©¥?¥È¤Ï ISO-2022-JP ¤Ç¤¹¡£
432 *
433 * @param charset ¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤Ë»ÈÍѤ¹¤?ʸ»ú¥³¡¼¥É
434 */
435 public void setCharset(String charset) {
436 this.charset = charset;
437 }
438
439 /***
440 * ¥»¥Ã¥È¤µ¤?¤¿SMTP¥µ¡¼¥Ð¤Î¥Û¥¹¥È̾¡¢¤Þ¤¿¤ÏIP¥¢¥É¥?¥¹¤òÊÖ¤·¤Þ¤¹¡£
441 *
442 * @return SMTP¥µ¡¼¥Ð¤Î¥Û¥¹¥È̾¡¢¤Þ¤¿¤ÏIP¥¢¥É¥?¥¹
443 */
444 public String getHost() {
445 return host;
446 }
447
448 /***
449 * SMTP¥µ¡¼¥Ð¤Î¥Û¥¹¥È̾¡¢¤Þ¤¿¤ÏIP¥¢¥É¥?¥¹¤ò¥»¥Ã¥È¤·¤Þ¤¹¡£
450 * ¥Ç¥Õ¥©¥?¥È¤Ï localhost ¤Ç¤¹¡£
451 *
452 * @param host SMTP¥µ¡¼¥Ð¤Î¥Û¥¹¥È̾¡¢¤Þ¤¿¤ÏIP¥¢¥É¥?¥¹
453 */
454 public void setHost(String host) {
455 this.host = host;
456 }
457
458 /***
459 * @return SMTP¥µ¡¼¥Ðǧ¾Ú¥Ñ¥¹¥?¡¼¥É
460 */
461 public String getPassword() {
462 return password;
463 }
464
465 /***
466 * SMTP¥µ¡¼¥Ð¤ÎÀܳǧ¾Ú¤¬É¬Íפʾ?¹ç¤Ë¥Ñ¥¹¥?¡¼¥É¤ò¥»¥Ã¥È¤·¤Þ¤¹¡£
467 *
468 * @param password SMTP¥µ¡¼¥Ðǧ¾Ú¥Ñ¥¹¥?¡¼¥É
469 */
470 public void setPassword(String password) {
471 this.password = password;
472 }
473
474 /***
475 * @return SMTP¥µ¡¼¥Ð¤Î¥Ý¡¼¥ÈÈÖ¹?
476 */
477 public int getPort() {
478 return port;
479 }
480
481 /***
482 * SMTP¥µ¡¼¥Ð¤Î¥Ý¡¼¥ÈÈÖ¹æ¤ò¥»¥Ã¥È¤·¤Þ¤¹¡£
483 *
484 * @param port SMTP¥µ¡¼¥Ð¤Î¥Ý¡¼¥ÈÈÖ¹?
485 */
486 public void setPort(int port) {
487 this.port = port;
488 }
489
490 /***
491 * @return Returns the protocol.
492 */
493 public String getProtocol() {
494 return protocol;
495 }
496
497 /***
498 * @param protocol The protocol to set.
499 */
500 public void setProtocol(String protocol) {
501 this.protocol = protocol;
502 }
503
504 /***
505 * @return Return-Path¥¢¥É¥?¥¹
506 */
507 public String getReturnPath() {
508 return returnPath;
509 }
510
511 /***
512 * Return-Path¥¢¥É¥?¥¹¤ò¥»¥Ã¥È¤·¤Þ¤¹¡£
513 *
514 * @param returnPath Return-Path¥¢¥É¥?¥¹
515 */
516 public void setReturnPath(String returnPath) {
517 this.returnPath = returnPath;
518 }
519
520 /***
521 * @return SMTP¥µ¡¼¥Ðǧ¾Ú¥æ¡¼¥¶Ì¾
522 */
523 public String getUsername() {
524 return username;
525 }
526
527 /***
528 * SMTP¥µ¡¼¥Ð¤ÎÀܳǧ¾Ú¤¬É¬Íפʾ?¹ç¤Ë¥æ¡¼¥¶Ì¾¤ò¥»¥Ã¥È¤·¤Þ¤¹¡£
529 *
530 * @param username SMTP¥µ¡¼¥Ðǧ¾Ú¥æ¡¼¥¶Ì¾
531 */
532 public void setUsername(String username) {
533 this.username = username;
534 }
535
536 }