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.
32 using System.Collections;
33 using System.Runtime.Serialization;
35 namespace System.Net.Mail {
37 public class SmtpFailedRecipientException : SmtpException, ISerializable
41 string failedRecipient;
47 public SmtpFailedRecipientException ()
51 public SmtpFailedRecipientException (string message) : base (message)
55 protected SmtpFailedRecipientException (SerializationInfo serializationInfo, StreamingContext streamingContext)
56 : base (serializationInfo, streamingContext)
58 if (serializationInfo == null)
59 throw new ArgumentNullException ("serializationInfo");
60 failedRecipient = serializationInfo.GetString ("failedRecipient");
63 public SmtpFailedRecipientException (SmtpStatusCode statusCode, string failedRecipient) : base (statusCode)
65 this.failedRecipient = failedRecipient;
68 public SmtpFailedRecipientException (string message, Exception innerException) : base (message, innerException)
72 public SmtpFailedRecipientException (string message, string failedRecipient, Exception innerException) : base (message, innerException)
74 this.failedRecipient = failedRecipient;
77 public SmtpFailedRecipientException (SmtpStatusCode statusCode, string failedRecipient, string serverResponse) : base (statusCode, serverResponse)
79 this.failedRecipient = failedRecipient;
82 #endregion // Constructors
86 public string FailedRecipient {
87 get { return failedRecipient; }
90 #endregion // Properties
94 public override void GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)
96 if (serializationInfo == null)
97 throw new ArgumentNullException ("serializationInfo");
98 base.GetObjectData (serializationInfo, streamingContext);
99 serializationInfo.AddValue ("failedRecipient", failedRecipient);
101 #if !TARGET_JVM //remove private implementation
102 void ISerializable.GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)
104 GetObjectData (serializationInfo, streamingContext);
108 #endregion // Methods