本文整理汇总了C#中System.Net.Mail.SmtpConnection.GetConnection方法的典型用法代码示例。如果您正苦于以下问题:C# SmtpConnection.GetConnection方法的具体用法?C# SmtpConnection.GetConnection怎么用?C# SmtpConnection.GetConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Net.Mail.SmtpConnection
的用法示例。
在下文中一共展示了SmtpConnection.GetConnection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetConnection
internal void GetConnection(ServicePoint servicePoint)
{
try {
Debug.Assert(servicePoint != null, "no ServicePoint provided by SmtpClient");
// check to see if we have a different connection than last time
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;
}
connection.GetConnection(servicePoint);
}
finally {
}
}
示例2: 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 { }
}