Jump to content
Server Maintenance This Week. ×

Newbie on the Email plugin


This topic is 4814 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Currently evaluating email options from Filemaker and currently use your ftp plug in.

My issue seems to be an inability to have it run smoothly and fast. It would appear that in a pop3 setting even if I mark an email for deletion it appears again and in the case of the demo I seem to have to wait a very long time for each email to view and then mark delete.

Even in Imap the ones marked delete do not appear to be removed from the server and when i log in again they download again.

(Apple - FM 11 Advanced)

Thoughts??

Regards

Anutha

Link to comment
Share on other sites

Flagging a message for deletion does not immediately remove it from your server. Your server runs on a schedule where it goes through the messages and deletes them periodically. I recommend that you use the "deleted=false" parameter when reading messages with the emailreadmessage function to skip any messages which have been flagged for deletion.

To delete messages, make sure that you call emailreadmessages with the "readonly=false" parameter, which will allow you to make changes to the email, and then call EmailMessageSetFlag("deleted") to delete or flag the message for deletion (depending on how your server handles it).

Link to comment
Share on other sites

  • 6 months later...
  • Newbies

Flagging a message for deletion does not immediately remove it from your server. Your server runs on a schedule where it goes through the messages and deletes them periodically. I recommend that you use the "deleted=false" parameter when reading messages with the emailreadmessage function to skip any messages which have been flagged for deletion.

To delete messages, make sure that you call emailreadmessages with the "readonly=false" parameter, which will allow you to make changes to the email, and then call EmailMessageSetFlag("deleted") to delete or flag the message for deletion (depending on how your server handles it).

The act of causing the messages to be deleted from the IMAP server is supposed to be initiated from the IMAP client, via the "EXPUNGE" command - see RFC 3501: http://www.faqs.org/rfcs/rfc3501.html

I am including several quotes from the RFC to highlight the relevant portion - but I believe the plugin is just using LOGOUT, which does not explicitly EXPUNGE messages marked to be deleted. A CLOSE command would EXPUNGE the messages marked for deletion, as would simply calling EXPUNGE directly.

We're using your email plugin and just noticed this behavior and we're looking for a workaround for this. I'm looking at simply writing a perl script to do it externally, which would be an ugly hack, but would at least get the old mail removed regularly.

Any chance you could take a look at adding a method to your plugin that would call EXPUNGE via IMAP? perhaps "EmailExpungeDeleted" or something of the sort?

Thank you for your time,

6.1.3. LOGOUT Command

Arguments: none

Responses: REQUIRED untagged response: BYE

Result: OK - logout completed

BAD - command unknown or arguments invalid

The LOGOUT command informs the server that the client is done with

the connection. The server MUST send a BYE untagged response

before the (tagged) OK response, and then close the network

connection.

Example: C: A023 LOGOUT

S: * BYE IMAP4rev1 Server logging out

S: A023 OK LOGOUT completed

(Server and client then close the connection)

6.4.2. CLOSE Command

Arguments: none

Responses: no specific responses for this command

Result: OK - close completed, now in authenticated state

BAD - command unknown or arguments invalid

The CLOSE command permanently removes all messages that have the

\Deleted flag set from the currently selected mailbox, and returns

to the authenticated state from the selected state. No untagged

EXPUNGE responses are sent.

No messages are removed, and no error is given, if the mailbox is

selected by an EXAMINE command or is otherwise selected read-only.

Even if a mailbox is selected, a SELECT, EXAMINE, or LOGOUT

command MAY be issued without previously issuing a CLOSE command.

The SELECT, EXAMINE, and LOGOUT commands implicitly close the

currently selected mailbox without doing an expunge. However,

when many messages are deleted, a CLOSE-LOGOUT or CLOSE-SELECT

sequence is considerably faster than an EXPUNGE-LOGOUT or

EXPUNGE-SELECT because no untagged EXPUNGE responses (which the

client would probably ignore) are sent.

Example: C: A341 CLOSE

S: A341 OK CLOSE completed

6.4.3. EXPUNGE Command

Arguments: none

Responses: untagged responses: EXPUNGE

Result: OK - expunge completed

NO - expunge failure: can't expunge (e.g., permission

denied)

BAD - command unknown or arguments invalid

The EXPUNGE command permanently removes all messages that have the

\Deleted flag set from the currently selected mailbox. Before

returning an OK to the client, an untagged EXPUNGE response is

sent for each message that is removed.

Example: C: A202 EXPUNGE

S: * 3 EXPUNGE

S: * 3 EXPUNGE

S: * 5 EXPUNGE

S: * 8 EXPUNGE

S: A202 OK EXPUNGE completed

Note: In this example, messages 3, 4, 7, and 11 had the

\Deleted flag set. See the description of the EXPUNGE

response for further explanation.

Link to comment
Share on other sites

  • Newbies

Thanks for the quick reply.

In case anyone encounters this thread and the functionality is not yet supported by the plugin - here is a perl script to make the expunge happen:

To use it you will need to modify and add in the correct username/password/server information for your own environment.

Code just logs into an IMAP account, goes through all of it's folders, and expunges all messages that have previously been marked for deletion.

Uses the Net::IMAP::Simple module to do all the work, additional information on that can be found here: http://search.cpan.org/~jettero/Net-IMAP-Simple-1.2020/Simple.pod

#!/usr/bin/env perl

# ===============================================================================

# Author: Neil Neely <[email protected]>

# Copyright 2011, Front Range Internet, Inc.

# ===============================================================================

# Description:

# This script will log into the configured account and run the IMAP EXPUNGE on

# the specified folder

# ===============================================================================

# License:

# Perl Artistic

# see: http://dev.perl.org/licenses/artistic.html

# THIS CODE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR

# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED

# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.

# ===============================================================================

# WHO DATE VERSION WHAT

# neil 2011/02/28 0.01 Initial Version

# ===============================================================================

our $VERSION = 0.01;

use warnings;

use strict;

use Net::IMAP::Simple;

my $user = 'PUT_USERNAME_HERE';

my $password = 'PUT_PASSWORD_HERE';

my $server = 'YOURMAILSERVER.YOURDOMAIN.com';

# Create the object

my $imap = Net::IMAP::Simple->new($server) ||

die "Unable to connect to IMAP: $Net::IMAP::Simple::errstr\n";

# Log on

if(!$imap->login($user,$password)){

die "Login failed: " . $imap->errstr . "\n";

}

my @folders = $imap->mailboxes;

foreach my $folder (@folders){

$imap->expunge_mailbox($folder) || die "Expunge failed on folder $folder: " . $imap->errstr . "\n";

}

$imap->quit;

Link to comment
Share on other sites

This topic is 4814 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.