Package: SMTPSendFailedException
SMTPSendFailedException
name | instruction | branch | complexity | line | method | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
SMTPSendFailedException(String, int, String, Exception, Address[], Address[], Address[]) |
|
|
|
|
|
||||||||||||||||||||
getCommand() |
|
|
|
|
|
||||||||||||||||||||
getReturnCode() |
|
|
|
|
|
Coverage
1: /*
2: * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved.
3: *
4: * This program and the accompanying materials are made available under the
5: * terms of the Eclipse Public License v. 2.0, which is available at
6: * http://www.eclipse.org/legal/epl-2.0.
7: *
8: * This Source Code may also be made available under the following Secondary
9: * Licenses when the conditions for such availability set forth in the
10: * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
11: * version 2 with the GNU Classpath Exception, which is available at
12: * https://www.gnu.org/software/classpath/license.html.
13: *
14: * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15: */
16:
17: package org.eclipse.angus.mail.smtp;
18:
19: import jakarta.mail.Address;
20: import jakarta.mail.SendFailedException;
21: import jakarta.mail.internet.InternetAddress;
22:
23: /**
24: * This exception is thrown when the message cannot be sent. <p>
25: *
26: * This exception will usually appear first in a chained list of exceptions,
27: * followed by SMTPAddressFailedExceptions and/or
28: * SMTPAddressSucceededExceptions, * one per address.
29: * This exception corresponds to one of the SMTP commands used to
30: * send a message, such as the MAIL, DATA, and "end of data" commands,
31: * but not including the RCPT command.
32: *
33: * @since JavaMail 1.3.2
34: */
35:
36: public class SMTPSendFailedException extends SendFailedException {
37: protected InternetAddress addr;        // address that failed
38: protected String cmd;                // command issued to server
39: protected int rc;                        // return code from SMTP server
40:
41: private static final long serialVersionUID = 8049122628728932894L;
42:
43: /**
44: * Constructs an SMTPSendFailedException with the specified
45: * address, return code, and error string.
46: *
47: * @param cmd        the command that was sent to the SMTP server
48: * @param rc        the SMTP return code indicating the failure
49: * @param err        the error string from the SMTP server
50: * @param ex        a chained exception
51: * @param vs        the valid addresses the message was sent to
52: * @param vus        the valid addresses the message was not sent to
53: * @param inv        the invalid addresses
54: */
55: public SMTPSendFailedException(String cmd, int rc, String err, Exception ex,
56:                                 Address[] vs, Address[] vus, Address[] inv) {
57:         super(err, ex, vs, vus, inv);
58:         this.cmd = cmd;
59:         this.rc = rc;
60: }
61:
62: /**
63: * Return the command that failed.
64: *
65: * @return        the command
66: */
67: public String getCommand() {
68:         return cmd;
69: }
70:
71: /**
72: * Return the return code from the SMTP server that indicates the
73: * reason for the failure. See
74: * <A HREF="http://www.ietf.org/rfc/rfc821.txt">RFC 821</A>
75: * for interpretation of the return code.
76: *
77: * @return        the return code
78: */
79: public int getReturnCode() {
80:         return rc;
81: }
82: }