Jump to content
Server Maintenance This Week. ×

Unable to Flag Messages as viewed


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

Recommended Posts

I have a Portfolio license and I need to download emails from FMSA 10 running in Mac XServe with Leopard. At this time I am testing with FMPA 10

I am trying to download emails recursively and to flag them as viewed once downloaded.

I am using the code below, but everytime I reconnect to download I get the full batch from the beginning.

***********************

//After successfully connecting to POP account

SetVariable [$result ; Value:EmailReadMessages(

"attachments=true" ;

"max=25" ;

"readonly=false" ;

"progress=true" ;

"viewed=false";

"deleted=false";

"flagged=false" ;

)]

Loop

Exit Loop If[not EmailGetNextMessage]

// Here I apply some business rules and create records

SetVariable [ $result ; Value:EmailMessageSetFlag ("viewed") }

EndLoop

SetVariable [ $disconnected; Value:EmailDisconnect]

// $disconnected Error trapping

***********************

Could someone tell me what I am doing wrong?

Thanks

David

Link to comment
Share on other sites

Thank you for your answer.

I was trying to avoid having to use that flag, since that would mean having to introduce extra logic in my coding to account for deleted messages, keeping track of emails downloaded by other clients or automatically deleted after certain amount of time, etc. and that seems too cumbersome when there is a function just to do that automatically (or at least that's what I thought)

Are you implying that the "viewed" flag is useless, if the only way to avoid re-downloading an email is by skipping it using the skip flag?

I thought there could be a simpler way to deal with this issue, any advice.. or could you point me to some code where I could see how to deal with it?

Thanks

Link to comment
Share on other sites

That is a valid way to do that as well, though you will not get an email if it is marked read in another program. There are three ways of importing unread messages (two for POP email). You can read the different techniques in the "Fetching unread messages" section of the EmailReadMessages function in the documentation for this plugin.

The documentation is in the documentation.html file which was included in the download of the plugin, or it can be found online at http://www.360works.com/plugins/EMAILPLUG/documentation.html#EmailReadMessages

EDIT: Actually, I think that "skip" is the only way to do it with POP mail. POP doesn't support message flags like viewed and deleted, and so you will be unable to set and filter for those flags in your download function. When you see a message as "Read" or "Unread" in your mail client, it is just something that the mail client is doing to help you organize you email.

Edited by Guest
Link to comment
Share on other sites

Thank you once again.

I had read many times the plug-in documentation but overall is very succinct and didn't address this particular issue with a lot of depth.

I didn't know about that shortcoming in the POP downloads method.

My previous experience with POP downloads was mostly through MS Outlook Client and Dacons Mail.it plug-in for Filemaker that now I am trying to migrate to 360 Works plug In (I am mostly interested in the server use of the plug-in)

Although I never had to deal with those issues in a programmatic way, it was just a check box or setting, after what you are telling me I guess the software or plug-in were dealing with that issue behind the scenes on the client side . Which tells me there must be some procedure that I could follow to achieve that same result, even if I have to do the programming myself.

The 2 things that come to my mind are some kind of unique identifier validation and the skip function which looks to me like a very unreliable approach.

If you or someone else could share some additional thoughts or pointers it would be greatly appreciated.

Link to comment
Share on other sites

Which section of our documentation did you feel was inadequate?

You can mark messages read or unread in your FileMaker solution using scripting when you go to a particular message. You can mimic email client functionality by doing things like using conditional formatting of email titles in a portal or list view, bolding or unbolding if the message is read or unread.

As described in the documentation, the best way to track the number of emails to skip is through a field in your database which increments whenever you download new emails. If you want to try more advanced methods you can download a larger number of emails and then compare titles, dates, and times to see if the email is new or not, and then add or delete records based on that information.

There will always be problems syncing POP accounts as compared to IMAP or Exchange accounts, as relatively little information is stored on the mail server. Deleting a message in one place will not delete it on other machines, as POP emails are downloaded and stored locally.

You may find that the functionality of IMAP email meets you needs more fully. Depending on your mail host you may be able to make this switch very easily. Services like dreamhost and godaddy will let you use gmail's servers for email, and that allows you to just press a button to switch to email with zero fuss.

Link to comment
Share on other sites

David, thank you once again for your answer.

I didn't find the documentation inadequate at all, maybe at some points It wouldn't hurt to have more code or examples illustrating some points or functions, so my critic was for it to be a little dry on a few occasion.

Precisely the EmailRead function has code examples with bulk download and recursive download cases, it might be that the nature of this issue is complicated (with the POP drawbacks) or that I had unrealistic expectations.

The email accounts I am more concerned with are not going to be dealt with by human users directly , these are listeners that will be triggering different events in Filemaker, so is not so much a question of flagging them as read/unread.

I see that the POP server is going to have extra overhead in terms of programming so I will seriously consider migrating my email accounts to IMAP if possible.

Thank you for your advice.

Link to comment
Share on other sites

Hello David,

Some POP mailboxes support a unique message ID as well. Our plugin doesn't support POP UIDs currently, but may in the future. This would allow you to store the UID of the most recently processed message, and use that as an offset. If messages are deleted from the POP mailbox by some other application, this won't cause any gaps.

Thanks for pointing this out, we're always trying to improve the documentation (while keeping it succinct). Let me know if we can help with anything else.

Link to comment
Share on other sites

  • 2 weeks later...

The end of my story (almost):

Following your advice I migrated all my POP accounts to IMAP.

I wasn't able to configure my actual Plesk email server to use IMAP instead of POP, which I believe was a blessing in disguise, because it forced me to create a new Gmail account as a forwarding destination for the email accounts I run through FM.

When I was downloading all my emails directly from my POP accounts with my previous plug-in, I used to have all this FM scripting to filter and categorize incoming email, including my FM version of a spam filter.

Now that I am passing everything through my Gmail account, I can use Gmail's filters and rules to send incoming emails to multiple Mailboxes, so I don't have to deal with that on the FM end.

The advantages to that approach are obvious, I save a lot on programming time for the FM filtering interface, Google has all that I need, I don't have to worry about updating spam filters, it is much faster processing that applying the filters with FM, so FM only deals with nicely presorted emails in different IMAP Mailboxes.

The way I dealt with that in FM is by creating an Email Mailbox table, that besides rules, settings and preferences for every Inbox, stores in a field a parameter that will indicate what sub-scripts will be applied to a particular Mailbox, and a UID from the last message read.

My Download Script loops and sub-loops through my Inbox table and I run everything from FM Server with a scheduled script running every 5 minutes, so finally I will be able to get rid of one of my unreliable FM Pro client robots....

There is a little problem I have encountered while migrating from my FM Pro run script to the FM Server run version, but that is a slightly different subject so I will start a new thread with that one...

Link to comment
Share on other sites

  • 3 weeks later...

I am experiencing a very annoying issue which I am not sure relates directly to the plug-in or to Google email services.

In case this is a configuration issue on the Gmail end you might be able to give some tips or configuration settings to overcome this shortcoming.

My problem is that whenever a new email is added by Gmail to an existing conversation (when Gmail groups several emails, with related replies,etc) that new email is invisible for the plug in.

Only the first email is recognized, I have experienced this issue with my own scripting which goes by the last stored UID number and with the Client Email file provided by 360Works.

Do you know how to deal with this? Is it possible to make Google not to lump all messages together under this conversation groups? I haven't been able to find that setting, if not what can I do?

Are you familiar with this issue?

These "invisible" emails defeat the purpose of the automation and FM automatic email handling if I eventually have to re-send them until different tittles to fool the system.

Thanks for any help, tips or ideas...

Link to comment
Share on other sites

I have not been able to reproduce this issue. In the gmail account I am testing with gmail is grouping the emails, but newer emails are checked and received by the plugin in the proper order.

In our EmailClient.fp7 file emails are not grouped. When a new email (which Gmail groups as part of a conversation) the new email shows up at the top of the email list. Our email example client does not group emails into threads like gmail does, so they will not appear next to the other emails in the conversation in the way that gmail is grouping them. They will instead appear at the top of the list, in the order that they were received similar to the way an email client might display them.

Please double check that your newer emails are not being downloaded into the example client. You can click on the email box on the list on the left to check for and download new emails from that mailbox.

Please let me know if these emails are not appearing for you.

Link to comment
Share on other sites

When you are trying to reproduce this behavior, are you downloading from separate mailboxes (folders) or directly from the general inbox?

In my case I have over 50 mailboxes to which emails are assigned using automatic rules by Gmail. I am wondering if that could be a factor

Link to comment
Share on other sites

All of my messages in the conversation are in the same folder. You will need to check the folder that the message is placed in if you are moving emails to different folders, or using rules to place them in other locations.

Link to comment
Share on other sites

I finally discovered what was causing the problem.

For future reference in case someone runs into the same situation:

I had to turn off the Gmail Labs feature called: Advanced IMAP functions.

It looks like it was interfering with the ability of the plugin to identify new UID postings added to an existing conversation.

Link to comment
Share on other sites

This topic is 5166 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.