本文整理汇总了C#中SmtpClient.EndSendMail方法的典型用法代码示例。如果您正苦于以下问题:C# SmtpClient.EndSendMail方法的具体用法?C# SmtpClient.EndSendMail怎么用?C# SmtpClient.EndSendMail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SmtpClient
的用法示例。
在下文中一共展示了SmtpClient.EndSendMail方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: _UpdateResult
void _UpdateResult( ref SmtpClient oSmtp,
ref SmtpClientAsyncResult oResult )
{
//Get the item index from Tag property
int index = (int)oSmtp.Tag;
try
{
if( !chkTestRecipients.Checked )
{
oSmtp.EndSendMail( oResult );
_CrossThreadSetItemText( "Completed", index );
}
else
{
oSmtp.EndTestRecipients( oResult );
_CrossThreadSetItemText( "PASS", index );
}
m_nsuccess++;
}
catch( SmtpTerminatedException exp )
{
string err = exp.Message;
_CrossThreadSetItemText( err, index );
m_nfailure++;
}
catch( SmtpServerException exp )
{
string err = String.Format( "Exception: Server Respond: {0}", exp.ErrorMessage );
_CrossThreadSetItemText( err, index );
m_nfailure++;
}
catch( System.Net.Sockets.SocketException exp )
{
string err = String.Format( "Exception: Networking Error: {0} {1}", exp.ErrorCode, exp.Message );
_CrossThreadSetItemText( err, index );
m_nfailure++;
}
catch( System.ComponentModel.Win32Exception exp )
{
string err = String.Format( "Exception: System Error: {0} {1}", exp.ErrorCode, exp.Message );
_CrossThreadSetItemText( err, index );
m_nfailure++;
}
catch( System.Exception exp )
{
string err = String.Format( "Exception: Common: {0}", exp.Message );
_CrossThreadSetItemText(err, index );
m_nfailure++;
}
m_nsent++;
status.Text = String.Format( "Total {0}, Finished {1}, Succeeded {2}, Failed {3}",
m_ntotal,
m_nsent,
m_nsuccess,
m_nfailure);
}