PowerTCP Mail for .NET
AutoDelete Property
See Also  Send comments on this topic.
Dart.PowerTCP.Mail Namespace > Pop Class : AutoDelete Property




Controls the setting of the message "delete flag" when downloading messages.

Syntax

Visual Basic (Declaration) 
<DescriptionAttribute("When true, the Delete property of each PopMessage is set to true after the message is downloaded.")>
<DefaultValueAttribute()>
<CategoryAttribute("Behavior")>
Public Property AutoDelete As Boolean
Visual Basic (Usage)Copy Code
Dim instance As Pop
Dim value As Boolean
 
instance.AutoDelete = value
 
value = instance.AutoDelete
C# 
[DescriptionAttribute("When true, the Delete property of each PopMessage is set to true after the message is downloaded.")]
[DefaultValueAttribute()]
[CategoryAttribute("Behavior")]
public bool AutoDelete {get; set;}
Managed Extensions for C++ 
[DescriptionAttribute("When true, the Delete property of each PopMessage is set to true after the message is downloaded.")]
[DefaultValueAttribute()]
[CategoryAttribute("Behavior")]
public: __property bool get_AutoDelete();
public: __property void set_AutoDelete( 
   bool value
);
C++/CLI 
[DescriptionAttribute("When true, the Delete property of each PopMessage is set to true after the message is downloaded.")]
[DefaultValueAttribute()]
[CategoryAttribute("Behavior")]
public:
property bool AutoDelete {
   bool get();
   void set (    bool value);
}

Property Value

true if messages should be automatically marked for deletion after they are downloaded; false otherwise. The default value is false.

Example

The following example demonstrates logging into a POP server and retrieving all messages.
Visual BasicCopy Code
' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Mail"
' at the top of your class.

' Automatically remove files after getting them from the server
Pop1.AutoDelete = True

' Login. The default settings will cause the Pop component to
' automatically retrieve all messages, delete them from the
' server, and logout.
Pop1.Login("mail.test.com", "testuser", "testpass")

' All message retrieved. Iterate through the collection
' and display data.
Dim msg As PopMessage
For Each msg In Pop1.Messages
   Debug.WriteLine("Message ID: " + msg.Id)
   Debug.WriteLine("Message UID: " + msg.Uid)
   Debug.WriteLine("Messge Size: " + msg.Size)
   Debug.WriteLine("From: " + msg.Message.From.Address)
   Debug.WriteLine("Subject: " + msg.Message.Subject)
Next
C#Copy Code
// Be sure to import the namespace by putting "using Dart.PowerTCP.Mail;"
// at the top of your class.

// Automatically remove files after getting them from the server
pop1.AutoDelete = true;

// Login. The default settings will cause the Pop component to
// automatically retrieve all messages, delete them from the
// server, and logout.
pop1.Login("mail.test.com", "testuser", "testpass");

// All message retrieved. Iterate through the collection
// and display data.
foreach(PopMessage msg in pop1.Messages)
{
   Debug.WriteLine("Message ID: " + msg.Id);
   Debug.WriteLine("Message UID: " + msg.Uid);
   Debug.WriteLine("Messge Size: " + msg.Size);
   Debug.WriteLine("From: " + msg.Message.From.Address);
   Debug.WriteLine("Subject: " + msg.Message.Subject);
}

Remarks

Each PopMessage object has a PopMessage.Delete property which, when set, will mark the message for deletion. Setting the Pop.AutoDelete property to true means that all messages, once downloaded, will be automatically marked for deletion. The Pop.AutoDelete property is false by default, meaning that you must explicitly set the PopMessage.Delete property if you wish for all downloaded messages to be deleted. If you would like to have more fine-tuned control over which messages are deleted, set the Pop.AutoLogout property to false, and simply set the PopMessage.Delete property to true for each message you would like deleted.

Note: Since all messages marked for deletion are deleted just prior to logout, depending on the amount of messages that are marked, there may be a slight delay before the Pop.Logout method returns.

Requirements

Target Platforms: Microsoft .NET Framework 2.0

See Also

Documentation Version 3.2
© 2010 Dart Communications. All Rights Reserved.