Forum Post
Index > Scribe > deleting attachments from script

Author/Date deleting attachments from script
12/06/2010 7:47pm
I'm trying to create a script that will delete attachments named *.vcf or winmail.dat. So far, I've got it so that it will print the names of attachments that meet the criteria, but it won't delete them. Here's the code:

for (n=0; n<Mail.Attachments; n++)
    a = Mail.Attachment[n];
    if (Strstr(, ".vcf") >=0 || Strstr(, "winmail.dat") >= 0)
        Print("Delete: " + + " from " + Mail.From.Name + "\n");

Why aren't the attachments deleted?
13/06/2010 3:34am
'Delete' is the system function that free's a scripting struct object from memory, 'DeleteThing' will free a Scribe object... you want 'DeleteThing'.
13/06/2010 3:52am
One other thing... DeleteThing will decrease the value of Mail.Attachments, so you'll probably want to do 'n--;' as well after the DeleteThing.
15/06/2010 12:57am
works like a charm -- thanks for the help