KickJava   Java API By Example, From Geeks To Geeks.

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


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  * @(#)SMTPAddressFailedException.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.SendFailedException JavaDoc;
31 import javax.mail.internet.InternetAddress JavaDoc;
32
33 /**
34  * This exception is thrown when the message cannot be sent. <p>
35  *
36  * The exception includes the address to which the message could not be
37  * sent. This will usually appear in a chained list of exceptions,
38  * one per address, attached to a top level SendFailedException that
39  * aggregates all the addresses.
40  *
41  * @since JavaMail 1.3.2
42  */

43
44 public class SMTPAddressFailedException extends SendFailedException JavaDoc {
45     protected InternetAddress JavaDoc addr; // address that failed
46
protected String JavaDoc cmd; // command issued to server
47
protected int rc; // return code from SMTP server
48

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

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

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

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

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