Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
SmtpTransport.cs
Go to the documentation of this file.
3
4namespace System.Net.Mail;
5
6internal sealed class SmtpTransport
7{
9
11
12 private readonly SmtpClient _client;
13
15
17
18 private bool _identityRequired;
19
20 private bool _shouldAbort;
21
22 private bool _enableSsl;
23
25
27 {
28 get
29 {
30 return _credentials;
31 }
32 set
33 {
35 }
36 }
37
38 internal bool IdentityRequired
39 {
40 get
41 {
42 return _identityRequired;
43 }
44 set
45 {
47 }
48 }
49
50 internal bool IsConnected
51 {
52 get
53 {
54 if (_connection != null)
55 {
57 }
58 return false;
59 }
60 }
61
62 internal bool EnableSsl
63 {
64 get
65 {
66 return _enableSsl;
67 }
68 set
69 {
71 }
72 }
73
75
76 internal bool ServerSupportsEai
77 {
78 get
79 {
80 if (_connection != null)
81 {
83 }
84 return false;
85 }
86 }
87
90 {
91 }
92
102
103 internal void GetConnection(string host, int port)
104 {
105 lock (this)
106 {
108 if (_shouldAbort)
109 {
111 }
112 _shouldAbort = false;
113 }
114 if (System.Net.NetEventSource.Log.IsEnabled())
115 {
116 System.Net.NetEventSource.Associate(this, _connection, "GetConnection");
117 }
118 if (EnableSsl)
119 {
120 _connection.EnableSsl = true;
121 _connection.ClientCertificates = ClientCertificates;
122 }
124 }
125
126 internal IAsyncResult BeginGetConnection(System.Net.ContextAwareResult outerResult, AsyncCallback callback, object state, string host, int port)
127 {
129 try
130 {
132 if (System.Net.NetEventSource.Log.IsEnabled())
133 {
134 System.Net.NetEventSource.Associate(this, _connection, "BeginGetConnection");
135 }
136 if (EnableSsl)
137 {
138 _connection.EnableSsl = true;
139 _connection.ClientCertificates = ClientCertificates;
140 }
142 }
144 {
146 }
147 if (System.Net.NetEventSource.Log.IsEnabled())
148 {
149 System.Net.NetEventSource.Info(this, "Sync completion", "BeginGetConnection");
150 }
151 return asyncResult;
152 }
153
154 internal void EndGetConnection(IAsyncResult result)
155 {
157 }
158
159 internal IAsyncResult BeginSendMail(MailAddress sender, MailAddressCollection recipients, string deliveryNotify, bool allowUnicode, AsyncCallback callback, object state)
160 {
161 if (sender == null)
162 {
163 throw new ArgumentNullException("sender");
164 }
165 if (recipients == null)
166 {
167 throw new ArgumentNullException("recipients");
168 }
170 sendMailAsyncResult.Send();
171 return sendMailAsyncResult;
172 }
173
174 internal void ReleaseConnection()
175 {
177 }
178
179 internal void Abort()
180 {
181 lock (this)
182 {
183 if (_connection != null)
184 {
186 }
187 else
188 {
189 _shouldAbort = true;
190 }
191 }
192 }
193
195 {
196 return SendMailAsyncResult.End(result);
197 }
198
200 {
201 if (sender == null)
202 {
203 throw new ArgumentNullException("sender");
204 }
205 if (recipients == null)
206 {
207 throw new ArgumentNullException("recipients");
208 }
211 exception = null;
212 foreach (MailAddress recipient in recipients)
213 {
214 string smtpAddress = recipient.GetSmtpAddress(allowUnicode);
215 string to = smtpAddress + (_connection.DSNEnabled ? deliveryNotify : string.Empty);
217 {
219 }
220 }
222 {
224 {
226 }
227 else
228 {
230 }
232 {
233 exception.fatal = true;
234 throw exception;
235 }
236 }
239 }
240}
void Add(TKey key, TValue value)
static void Send(SmtpConnection conn)
static void Send(SmtpConnection conn, byte[] command, MailAddress from, bool allowUnicode)
static bool Send(SmtpConnection conn, string to, out string response)
static MailWriter End(IAsyncResult result)
static readonly byte[] Mail
SmtpReplyReaderFactory Reader
IAsyncResult BeginGetConnection(System.Net.ContextAwareResult outerResult, AsyncCallback callback, object state, string host, int port)
void GetConnection(string host, int port)
void EndGetConnection(IAsyncResult result)
ICredentialsByHost Credentials
MailWriter SendMail(MailAddress sender, MailAddressCollection recipients, string deliveryNotify, bool allowUnicode, out SmtpFailedRecipientException exception)
void EndGetConnection(IAsyncResult result)
SmtpTransport(SmtpClient client)
IAsyncResult BeginGetConnection(System.Net.ContextAwareResult outerResult, AsyncCallback callback, object state, string host, int port)
MailWriter EndSendMail(IAsyncResult result)
SmtpTransport(SmtpClient client, ISmtpAuthenticationModule[] authenticationModules)
ICredentialsByHost _credentials
X509CertificateCollection ClientCertificates
IAsyncResult BeginSendMail(MailAddress sender, MailAddressCollection recipients, string deliveryNotify, bool allowUnicode, AsyncCallback callback, object state)
void GetConnection(string host, int port)
readonly List< SmtpFailedRecipientException > _failedRecipientExceptions
readonly SmtpClient _client
readonly ISmtpAuthenticationModule[] _authenticationModules
X509CertificateCollection _clientCertificates
static readonly System.Net.NetEventSource Log
static void Info(object thisOrContextObject, FormattableString formattableString=null, [CallerMemberName] string memberName=null)
static void Associate(object first, object second, [CallerMemberName] string memberName=null)
static string MailHostNotFound
Definition SR.cs:170
Definition SR.cs:7