2 // System.Net.Mail.SmtpFailedRecipientException.cs
5 // John Luke (john.luke@gmail.com)
7 // Copyright (C) John Luke, 2005
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
34 using System.Collections;
35 using System.Runtime.Serialization;
37 namespace System.Net.Mail {
39 public class SmtpFailedRecipientException : SmtpException, ISerializable
43 string failedRecipient;
49 public SmtpFailedRecipientException ()
53 public SmtpFailedRecipientException (string message) : base (message)
57 protected SmtpFailedRecipientException (SerializationInfo serializationInfo, StreamingContext streamingContext)
58 : base (serializationInfo, streamingContext)
60 if (serializationInfo == null)
61 throw new ArgumentNullException ("serializationInfo");
62 failedRecipient = serializationInfo.GetString ("failedRecipient");
65 public SmtpFailedRecipientException (SmtpStatusCode statusCode, string failedRecipient) : base (statusCode)
67 this.failedRecipient = failedRecipient;
70 public SmtpFailedRecipientException (string message, Exception innerException) : base (message, innerException)
74 public SmtpFailedRecipientException (string message, string failedRecipient, Exception innerException) : base (message, innerException)
76 this.failedRecipient = failedRecipient;
79 public SmtpFailedRecipientException (SmtpStatusCode statusCode, string failedRecipient, string serverResponse) : base (statusCode, serverResponse)
81 this.failedRecipient = failedRecipient;
84 #endregion // Constructors
88 public string FailedRecipient {
89 get { return failedRecipient; }
92 #endregion // Properties
96 public override void GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)
98 if (serializationInfo == null)
99 throw new ArgumentNullException ("serializationInfo");
100 base.GetObjectData (serializationInfo, streamingContext);
101 serializationInfo.AddValue ("failedRecipient", failedRecipient);
103 #if !TARGET_JVM //remove private implementation
104 void ISerializable.GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)
106 GetObjectData (serializationInfo, streamingContext);
110 #endregion // Methods