KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > mail > smtp > SMTPAddressSucceededException


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the "License"). You may not use this file except
5  * in compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * glassfish/bootstrap/legal/CDDLv1.0.txt or
9  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * HEADER in each file and include the License file at
15  * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
16  * add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your
18  * own identifying information: Portions Copyright [yyyy]
19  * [name of copyright owner]
20  */

21
22 /*
23  * @(#)SMTPAddressSucceededException.java 1.5 05/08/29
24  *
25  * Copyright 1997-2005 Sun Microsystems, Inc. All Rights Reserved.
26  */

27
28 package com.sun.mail.smtp;
29
30 import javax.mail.MessagingException JavaDoc;
31 import javax.mail.internet.InternetAddress JavaDoc;
32
33 /**
34  * This exception is chained off a SendFailedException when the
35  * <code>mail.smtp.reportsuccess</code> property is true. It
36  * indicates an address to which the message was sent. The command
37  * will be an SMTP RCPT command and the return code will be the
38  * return code from that command.
39  *
40  * @since JavaMail 1.3.2
41  */

42
43 public class SMTPAddressSucceededException extends MessagingException JavaDoc {
44     protected InternetAddress JavaDoc addr; // address that succeeded
45
protected String JavaDoc cmd; // command issued to server
46
protected int rc; // return code from SMTP server
47

48     private static final long serialVersionUID = -1168335848623096749L;
49
50     /**
51      * Constructs an SMTPAddressSucceededException with the specified
52      * address, return code, and error string.
53      *
54      * @param addr the address that succeeded
55      * @param cmd the command that was sent to the SMTP server
56      * @param rc the SMTP return code indicating the success
57      * @param err the error string from the SMTP server
58      */

59     public SMTPAddressSucceededException(InternetAddress JavaDoc addr,
60                 String JavaDoc cmd, int rc, String JavaDoc err) {
61     super(err);
62     this.addr = addr;
63     this.cmd = cmd;
64     this.rc = rc;
65     }
66
67     /**
68      * Return the address that succeeded.
69      */

70     public InternetAddress JavaDoc getAddress() {
71     return addr;
72     }
73
74     /**
75      * Return the command that succeeded.
76      */

77     public String JavaDoc getCommand() {
78     return cmd;
79     }
80
81
82     /**
83      * Return the return code from the SMTP server that indicates the
84      * reason for the success. See
85      * <A HREF="http://www.ietf.org/rfc/rfc821.txt">RFC 821</A>
86      * for interpretation of the return code.
87      */

88     public int getReturnCode() {
89     return rc;
90     }
91 }
92
Popular Tags