- 製 品
- 購 入
Order Online Maintenance Renewal Resellers - サポート
Helpdesk オンラインドキュメント(英語) Webフォーラム(英語) - Our Clients
- 当社について
About as サービス Contact
Back to Tutorials list
Back to Tutorials list
Determine If The Message Has Attachments Without Downloading The Entire Message
The developer should use HasAttachments property MailMessage to indicate if the message has attachments:
[C#]
MailMessageCollection msgs = pop.DownloadMessageHeaders();
foreach (MailMessage msg in msgs)
{
if (msg.HasAttachments)
{
Console.WriteLine("Message #" + msg.IndexOnServer + " has attachment(s)");
}
}
[VB.NET]
Dim msgs As MailMessageCollection = pop.DownloadMessageHeaders()
Dim msg As MailMessage
For Each msg In msgs
if (msg.HasAttachments) Then
Console.WriteLine("Message #" + msg.IndexOnServer + " has attachment(s)")
End If
Next
Note: This property may not be 100% accurate if only the header of the message has been downloaded. The developer should download the entire message to be sure if it really has any attachments or not.