KickJava   Java API By Example, From Geeks To Geeks.

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


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  * @(#)SMTPSendFailedException.java 1.3 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.Address JavaDoc;
31 import javax.mail.SendFailedException JavaDoc;
32 import javax.mail.internet.InternetAddress JavaDoc;
33
34 /**
35  * This exception is thrown when the message cannot be sent. <p>
36  *
37  * This exception will usually appear first in a chained list of exceptions,
38  * followed by SMTPAddressFailedExceptions and/or
39  * SMTPAddressSucceededExceptions, * one per address.
40  * This exception corresponds to one of the SMTP commands used to
41  * send a message, such as the MAIL, DATA, and "end of data" commands,
42  * but not including the RCPT command.
43  *
44  * @since JavaMail 1.3.2
45  */

46
47 public class SMTPSendFailedException extends SendFailedException JavaDoc {
48     protected InternetAddress JavaDoc addr; // address that failed
49
protected String JavaDoc cmd; // command issued to server
50
protected int rc; // return code from SMTP server
51

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

62     public SMTPSendFailedException(String JavaDoc cmd, int rc, String JavaDoc err, Exception JavaDoc ex,
63                 Address JavaDoc[] vs, Address JavaDoc[] vus, Address JavaDoc[] inv) {
64     super(err, ex, vs, vus, inv);
65     this.cmd = cmd;
66     this.rc = rc;
67     }
68
69     /**
70      * Return the command that failed.
71      */

72     public String JavaDoc getCommand() {
73     return cmd;
74     }
75
76     /**
77      * Return the return code from the SMTP server that indicates the
78      * reason for the failure. See
79      * <A HREF="http://www.ietf.org/rfc/rfc821.txt">RFC 821</A>
80      * for interpretation of the return code.
81      */

82     public int getReturnCode() {
83     return rc;
84     }
85 }
86
Popular Tags