115 lines
6.1 KiB
C#
115 lines
6.1 KiB
C#
using System;
|
|
using System.Runtime.Serialization;
|
|
|
|
namespace System.Net.Mail
|
|
{
|
|
/// <summary>Represents the exception that is thrown when the <see cref="T:System.Net.Mail.SmtpClient" /> is not able to complete a <see cref="Overload:System.Net.Mail.SmtpClient.Send" /> or <see cref="Overload:System.Net.Mail.SmtpClient.SendAsync" /> operation.</summary>
|
|
// Token: 0x0200014A RID: 330
|
|
[Serializable]
|
|
public class SmtpException : Exception, ISerializable
|
|
{
|
|
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.SmtpException" /> class. </summary>
|
|
// Token: 0x06000B50 RID: 2896 RVA: 0x00022D68 File Offset: 0x00020F68
|
|
public SmtpException()
|
|
: this(SmtpStatusCode.GeneralFailure)
|
|
{
|
|
}
|
|
|
|
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.SmtpException" /> class with the specified status code.</summary>
|
|
/// <param name="statusCode">An <see cref="T:System.Net.Mail.SmtpStatusCode" /> value.</param>
|
|
// Token: 0x06000B51 RID: 2897 RVA: 0x00022D74 File Offset: 0x00020F74
|
|
public SmtpException(SmtpStatusCode statusCode)
|
|
: this(statusCode, "Syntax error, command unrecognized.")
|
|
{
|
|
}
|
|
|
|
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.SmtpException" /> class with the specified error message.</summary>
|
|
/// <param name="message">A <see cref="T:System.String" /> that describes the error that occurred.</param>
|
|
// Token: 0x06000B52 RID: 2898 RVA: 0x00022D84 File Offset: 0x00020F84
|
|
public SmtpException(string message)
|
|
: this(SmtpStatusCode.GeneralFailure, message)
|
|
{
|
|
}
|
|
|
|
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.SmtpException" /> class from the specified instances of the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> and <see cref="T:System.Runtime.Serialization.StreamingContext" /> classes. </summary>
|
|
/// <param name="serializationInfo">A <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that contains the information required to serialize the new <see cref="T:System.Net.Mail.SmtpException" />. </param>
|
|
/// <param name="streamingContext">A <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains the source and destination of the serialized stream associated with the new instance. </param>
|
|
// Token: 0x06000B53 RID: 2899 RVA: 0x00022D90 File Offset: 0x00020F90
|
|
protected SmtpException(SerializationInfo info, StreamingContext context)
|
|
: base(info, context)
|
|
{
|
|
try
|
|
{
|
|
this.statusCode = (SmtpStatusCode)((int)info.GetValue("Status", typeof(int)));
|
|
}
|
|
catch (SerializationException)
|
|
{
|
|
this.statusCode = (SmtpStatusCode)((int)info.GetValue("statusCode", typeof(SmtpStatusCode)));
|
|
}
|
|
}
|
|
|
|
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.SmtpException" /> class with the specified status code and error message.</summary>
|
|
/// <param name="statusCode">An <see cref="T:System.Net.Mail.SmtpStatusCode" /> value.</param>
|
|
/// <param name="message">A <see cref="T:System.String" /> that describes the error that occurred.</param>
|
|
// Token: 0x06000B54 RID: 2900 RVA: 0x00022E0C File Offset: 0x0002100C
|
|
public SmtpException(SmtpStatusCode statusCode, string message)
|
|
: base(message)
|
|
{
|
|
this.statusCode = statusCode;
|
|
}
|
|
|
|
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.SmtpException" /> class with the specified error message and inner exception.</summary>
|
|
/// <param name="message">A <see cref="T:System.String" /> that describes the error that occurred.</param>
|
|
/// <param name="innerException">The exception that is the cause of the current exception. </param>
|
|
// Token: 0x06000B55 RID: 2901 RVA: 0x00022E1C File Offset: 0x0002101C
|
|
public SmtpException(string message, Exception innerException)
|
|
: base(message, innerException)
|
|
{
|
|
this.statusCode = SmtpStatusCode.GeneralFailure;
|
|
}
|
|
|
|
/// <summary>Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo" /> instance with the data needed to serialize the <see cref="T:System.Net.Mail.SmtpException" />.</summary>
|
|
/// <param name="serializationInfo">A <see cref="T:System.Runtime.Serialization.SerializationInfo" />, which holds the serialized data for the <see cref="T:System.Net.Mail.SmtpException" />. </param>
|
|
/// <param name="streamingContext">A <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains the destination of the serialized stream associated with the new <see cref="T:System.Net.Mail.SmtpException" />. </param>
|
|
// Token: 0x06000B56 RID: 2902 RVA: 0x00022E30 File Offset: 0x00021030
|
|
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
|
|
{
|
|
this.GetObjectData(info, context);
|
|
}
|
|
|
|
/// <summary>Gets the status code returned by an SMTP server when an e-mail message is transmitted.</summary>
|
|
/// <returns>An <see cref="T:System.Net.Mail.SmtpStatusCode" /> value that indicates the error that occurred.</returns>
|
|
// Token: 0x170002D8 RID: 728
|
|
// (get) Token: 0x06000B57 RID: 2903 RVA: 0x00022E3C File Offset: 0x0002103C
|
|
// (set) Token: 0x06000B58 RID: 2904 RVA: 0x00022E44 File Offset: 0x00021044
|
|
public SmtpStatusCode StatusCode
|
|
{
|
|
get
|
|
{
|
|
return this.statusCode;
|
|
}
|
|
set
|
|
{
|
|
this.statusCode = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo" /> instance with the data needed to serialize the <see cref="T:System.Net.Mail.SmtpException" />.</summary>
|
|
/// <param name="serializationInfo">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> to populate with data. </param>
|
|
/// <param name="streamingContext">A <see cref="T:System.Runtime.Serialization.StreamingContext" /> that specifies the destination for this serialization.</param>
|
|
// Token: 0x06000B59 RID: 2905 RVA: 0x00022E50 File Offset: 0x00021050
|
|
public override void GetObjectData(SerializationInfo info, StreamingContext context)
|
|
{
|
|
if (info == null)
|
|
{
|
|
throw new ArgumentNullException("info");
|
|
}
|
|
base.GetObjectData(info, context);
|
|
info.AddValue("Status", this.statusCode, typeof(int));
|
|
}
|
|
|
|
// Token: 0x04000B57 RID: 2903
|
|
private SmtpStatusCode statusCode;
|
|
}
|
|
}
|