本文整理汇总了C#中System.Net.Mail.SmtpConnection类的典型用法代码示例。如果您正苦于以下问题:C# SmtpConnection类的具体用法?C# SmtpConnection怎么用?C# SmtpConnection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SmtpConnection类属于System.Net.Mail命名空间,在下文中一共展示了SmtpConnection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: BeginGetConnection
internal IAsyncResult BeginGetConnection(ServicePoint servicePoint, ContextAwareResult outerResult, AsyncCallback callback, object state)
{
IAsyncResult result = null;
try
{
this.UpdateServicePoint(servicePoint);
this.connection = new SmtpConnection(this, this.client, this.credentials, this.authenticationModules);
this.connection.Timeout = this.timeout;
if (Logging.On)
{
Logging.Associate(Logging.Web, this, this.connection);
}
if (this.EnableSsl)
{
this.connection.EnableSsl = true;
this.connection.ClientCertificates = this.ClientCertificates;
}
result = this.connection.BeginGetConnection(servicePoint, outerResult, callback, state);
}
catch (Exception exception)
{
throw new SmtpException(SR.GetString("MailHostNotFound"), exception);
}
return result;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:25,代码来源:SmtpTransport.cs
示例2: BeginSend
internal static IAsyncResult BeginSend(SmtpConnection conn, AsyncCallback callback, object state)
{
MultiAsyncResult result = new MultiAsyncResult(conn, callback, state);
result.Enter();
IAsyncResult result2 = conn.BeginFlush(onWrite, result);
if (result2.CompletedSynchronously)
{
conn.EndFlush(result2);
result.Leave();
}
SmtpReplyReader nextReplyReader = conn.Reader.GetNextReplyReader();
result.Enter();
IAsyncResult result3 = nextReplyReader.BeginReadLines(onReadLines, result);
if (result3.CompletedSynchronously)
{
LineInfo[] infoArray = conn.Reader.CurrentReader.EndReadLines(result3);
if (!(result.Result is Exception))
{
result.Result = infoArray;
}
result.Leave();
}
result.CompleteSequence();
return result;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:25,代码来源:ReadLinesCommand.cs
示例3: BeginSend
internal static IAsyncResult BeginSend(SmtpConnection conn, AsyncCallback callback, object state)
{
MultiAsyncResult multiResult = new MultiAsyncResult(conn, callback, state);
multiResult.Enter();
IAsyncResult writeResult = conn.BeginFlush(s_onWrite, multiResult);
if (writeResult.CompletedSynchronously)
{
conn.EndFlush(writeResult);
multiResult.Leave();
}
SmtpReplyReader reader = conn.Reader.GetNextReplyReader();
multiResult.Enter();
//this actually does a read on the stream.
IAsyncResult result = reader.BeginReadLine(s_onReadLine, multiResult);
if (result.CompletedSynchronously)
{
LineInfo info = reader.EndReadLine(result);
if (!(multiResult.Result is Exception))
multiResult.Result = info;
multiResult.Leave();
}
multiResult.CompleteSequence();
return multiResult;
}
开发者ID:geoffkizer,项目名称:corefx,代码行数:25,代码来源:SmtpCommands.cs
示例4: PrepareCommand
private static void PrepareCommand(SmtpConnection conn)
{
if (conn.IsStreamOpen)
{
throw new InvalidOperationException(SR.GetString("SmtpDataStreamOpen"));
}
conn.BufferBuilder.Append(SmtpCommands.Data);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:DataCommand.cs
示例5: SendMailAsyncResult
internal SendMailAsyncResult(SmtpConnection connection, string from, MailAddressCollection toCollection, string deliveryNotify, AsyncCallback callback, object state) : base(null, state, callback)
{
this.failedRecipientExceptions = new ArrayList();
this.toCollection = toCollection;
this.connection = connection;
this.from = from;
this.deliveryNotify = deliveryNotify;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:SendMailAsyncResult.cs
示例6: PrepareCommand
private static void PrepareCommand(SmtpConnection conn, string type, string message)
{
conn.BufferBuilder.Append(SmtpCommands.Auth);
conn.BufferBuilder.Append(type);
conn.BufferBuilder.Append((byte) 0x20);
conn.BufferBuilder.Append(message);
conn.BufferBuilder.Append(SmtpCommands.CRLF);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:AuthCommand.cs
示例7: PrepareCommand
private static void PrepareCommand(SmtpConnection conn, byte[] command, string from)
{
if (conn.IsStreamOpen)
{
throw new InvalidOperationException(SR.GetString("SmtpDataStreamOpen"));
}
conn.BufferBuilder.Append(command);
conn.BufferBuilder.Append(from);
conn.BufferBuilder.Append(SmtpCommands.CRLF);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:10,代码来源:MailCommand.cs
示例8: Send
internal static SmtpStatusCode Send(SmtpConnection conn, out string response)
{
conn.Flush();
SmtpReplyReader reader = conn.Reader.GetNextReplyReader();
LineInfo info = reader.ReadLine();
response = info.Line;
reader.Close();
return info.StatusCode;
}
开发者ID:geoffkizer,项目名称:corefx,代码行数:9,代码来源:SmtpCommands.cs
示例9: GetConnection
internal void GetConnection(string host, int port)
{
try
{
_connection = new SmtpConnection(this, _client, _credentials, _authenticationModules);
_connection.Timeout = _timeout;
if (MailEventSource.Log.IsEnabled()) MailEventSource.Log.Associate(this, _connection);
if (EnableSsl)
{
_connection.EnableSsl = true;
_connection.ClientCertificates = ClientCertificates;
}
_connection.GetConnection(host, port);
}
finally { }
}
开发者ID:naamunds,项目名称:corefx,代码行数:18,代码来源:SmtpTransport.cs
示例10: BeginSend
internal static IAsyncResult BeginSend(SmtpConnection conn, byte[] command, string from, AsyncCallback callback, object state)
{
PrepareCommand(conn, command, from);
return CheckCommand.BeginSend(conn, callback, state);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:5,代码来源:MailCommand.cs
示例11: BeginGetConnection
internal IAsyncResult BeginGetConnection(ContextAwareResult outerResult, AsyncCallback callback, object state, string host, int port)
{
if (NetEventSource.IsEnabled) NetEventSource.Enter(this);
IAsyncResult result = null;
try
{
_connection = new SmtpConnection(this, _client, _credentials, _authenticationModules);
_connection.Timeout = _timeout;
if (NetEventSource.IsEnabled) NetEventSource.Associate(this, _connection);
if (EnableSsl)
{
_connection.EnableSsl = true;
_connection.ClientCertificates = ClientCertificates;
}
result = _connection.BeginGetConnection(outerResult, callback, state, host, port);
}
catch (Exception innerException)
{
throw new SmtpException(SR.MailHostNotFound, innerException);
}
if (NetEventSource.IsEnabled)
{
NetEventSource.Info(this, "Sync completion");
NetEventSource.Exit(this);
}
return result;
}
开发者ID:dotnet,项目名称:corefx,代码行数:29,代码来源:SmtpTransport.cs
示例12: BeginGetConnection
internal IAsyncResult BeginGetConnection(ServicePoint servicePoint, ContextAwareResult outerResult, AsyncCallback callback, object state)
{
GlobalLog.Enter("SmtpTransport#" + ValidationHelper.HashString(this) + "::BeginConnect");
IAsyncResult result = null;
try{
UpdateServicePoint(servicePoint);
connection = new SmtpConnection(this, client, credentials, authenticationModules);
connection.Timeout = timeout;
if(Logging.On)Logging.Associate(Logging.Web, this, connection);
if (EnableSsl)
{
connection.EnableSsl = true;
connection.ClientCertificates = ClientCertificates;
}
result = connection.BeginGetConnection(servicePoint, outerResult, callback, state);
}
catch(Exception innerException){
throw new SmtpException(SR.GetString(SR.MailHostNotFound), innerException);
}
GlobalLog.Leave("SmtpTransport#" + ValidationHelper.HashString(this) + "::BeginConnect [....] Completion");
return result;
}
开发者ID:REALTOBIZ,项目名称:mono,代码行数:23,代码来源:SmtpTransport.cs
示例13: Send
internal static LineInfo Send(SmtpConnection conn, string type, string message)
{
PrepareCommand(conn, type, message);
return CheckResponse(ReadLinesCommand.Send(conn));
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:5,代码来源:AuthCommand.cs
示例14: Send
internal static void Send(SmtpConnection conn)
{
string str;
PrepareCommand(conn);
CheckResponse(CheckCommand.Send(conn, out str), str);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:6,代码来源:DataCommand.cs
示例15: ConnectAndHandshakeAsyncResult
internal ConnectAndHandshakeAsyncResult(SmtpConnection connection, string host, int port, ContextAwareResult outerResult, AsyncCallback callback, object state) :
base(null, state, callback)
{
_connection = connection;
_host = host;
_port = port;
_outerResult = outerResult;
}
开发者ID:naamunds,项目名称:corefx,代码行数:9,代码来源:SmtpConnection.cs
示例16: ConnectAndHandshakeAsyncResult
internal ConnectAndHandshakeAsyncResult(SmtpConnection connection, string host, int port, ContextAwareResult outerResult, AsyncCallback callback, object state) : base(null, state, callback)
{
this.currentModule = -1;
this.connection = connection;
this.host = host;
this.port = port;
this.m_OuterResult = outerResult;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:SmtpConnection.cs
示例17: BeginSend
internal static IAsyncResult BeginSend(SmtpConnection conn, string type, string message, AsyncCallback callback, object state)
{
PrepareCommand(conn, type, message);
return ReadLinesCommand.BeginSend(conn, callback, state);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:5,代码来源:AuthCommand.cs
示例18: Send
internal static bool Send(SmtpConnection conn, string to, out string response)
{
PrepareCommand(conn, to);
return CheckResponse(CheckCommand.Send(conn, out response), response);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:5,代码来源:RecipientCommand.cs
示例19: BeginSend
internal static IAsyncResult BeginSend(SmtpConnection conn, string domain, AsyncCallback callback, object state)
{
PrepareCommand(conn, domain);
return ReadLinesCommand.BeginSend(conn, callback, state);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:5,代码来源:EHelloCommand.cs
示例20: Send
internal static string[] Send(SmtpConnection conn, string domain)
{
PrepareCommand(conn, domain);
return CheckResponse(ReadLinesCommand.Send(conn));
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:5,代码来源:EHelloCommand.cs
注:本文中的System.Net.Mail.SmtpConnection类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论