Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
MailCommand.cs
Go to the documentation of this file.
1namespace System.Net.Mail;
2
3internal static class MailCommand
4{
5 internal static IAsyncResult BeginSend(SmtpConnection conn, byte[] command, MailAddress from, bool allowUnicode, AsyncCallback callback, object state)
6 {
7 PrepareCommand(conn, command, from, allowUnicode);
8 return CheckCommand.BeginSend(conn, callback, state);
9 }
10
11 private static void CheckResponse(SmtpStatusCode statusCode, string response)
12 {
13 if (statusCode == SmtpStatusCode.Ok)
14 {
15 return;
16 }
17 switch (statusCode)
18 {
19 default:
20 if (statusCode < (SmtpStatusCode)400)
21 {
23 }
24 throw new SmtpException(statusCode, response, serverResponse: true);
25 }
26 }
27
28 internal static void EndSend(IAsyncResult result)
29 {
30 string response;
31 SmtpStatusCode statusCode = (SmtpStatusCode)CheckCommand.EndSend(result, out response);
32 CheckResponse(statusCode, response);
33 }
34
35 private static void PrepareCommand(SmtpConnection conn, byte[] command, MailAddress from, bool allowUnicode)
36 {
37 if (conn.IsStreamOpen)
38 {
40 }
41 conn.BufferBuilder.Append(command);
42 string smtpAddress = from.GetSmtpAddress(allowUnicode);
43 conn.BufferBuilder.Append(smtpAddress, allowUnicode);
44 if (allowUnicode)
45 {
46 conn.BufferBuilder.Append(" BODY=8BITMIME SMTPUTF8");
47 }
49 }
50
51 internal static void Send(SmtpConnection conn, byte[] command, MailAddress from, bool allowUnicode)
52 {
53 PrepareCommand(conn, command, from, allowUnicode);
54 string response;
55 SmtpStatusCode statusCode = CheckCommand.Send(conn, out response);
56 CheckResponse(statusCode, response);
57 }
58}
static SmtpStatusCode Send(SmtpConnection conn, out string response)
static IAsyncResult BeginSend(SmtpConnection conn, AsyncCallback callback, object state)
static object EndSend(IAsyncResult result, out string response)
string GetSmtpAddress(bool allowUnicode)
static void PrepareCommand(SmtpConnection conn, byte[] command, MailAddress from, bool allowUnicode)
static void Send(SmtpConnection conn, byte[] command, MailAddress from, bool allowUnicode)
static IAsyncResult BeginSend(SmtpConnection conn, byte[] command, MailAddress from, bool allowUnicode, AsyncCallback callback, object state)
Definition MailCommand.cs:5
static void CheckResponse(SmtpStatusCode statusCode, string response)
static void EndSend(IAsyncResult result)
static readonly byte[] CRLF
static string net_webstatus_ServerProtocolViolation
Definition SR.cs:152
static string SmtpDataStreamOpen
Definition SR.cs:154
Definition SR.cs:7