本文整理汇总了C#中System.Net.Mail.SmtpConnection.BeginGetConnection方法的典型用法代码示例。如果您正苦于以下问题:C# SmtpConnection.BeginGetConnection方法的具体用法?C# SmtpConnection.BeginGetConnection怎么用?C# SmtpConnection.BeginGetConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Net.Mail.SmtpConnection
的用法示例。
在下文中一共展示了SmtpConnection.BeginGetConnection方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BeginGetConnection
internal IAsyncResult BeginGetConnection(ContextAwareResult outerResult, AsyncCallback callback, object state, string host, int port)
{
if (GlobalLog.IsEnabled)
{
GlobalLog.Enter("SmtpTransport#" + LoggingHash.HashString(this) + "::BeginConnect");
}
IAsyncResult result = null;
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;
}
result = _connection.BeginGetConnection(outerResult, callback, state, host, port);
}
catch (Exception innerException)
{
throw new SmtpException(SR.MailHostNotFound, innerException);
}
if (GlobalLog.IsEnabled)
{
GlobalLog.Leave("SmtpTransport#" + LoggingHash.HashString(this) + "::BeginConnect Sync Completion");
}
return result;
}
示例2: 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;
}
示例3: 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;
}