close
Comments you submit will be routed for moderation. If you have an account, please log in first.
Modify

Opened 4 years ago

Last modified 10 months ago

#107 accepted enhancement

ARexx - MAILIMPORT / MAILEXPORT : return FILENAME

Reported by: AmigaPhil Owned by:
Priority: undecided Milestone: YAM future release
Component: ARexx interface Version:
Severity: major Keywords:
Cc: OS Platform:
Blocked By: Blocking:
Release Notes:

Description (last modified by damato)

This feature has already been partially discussed, but the issue is still a blocker problem for me: I can't operate on freshly imported mails because I found no way to identify those mails.

My suggestion is to allow the MAILIMPORT to return:

  • the INDEX of the last imported mail,
  • VAR/K as alternative variable for result,
  • <STEM>COUNT : number of imported mails <STEM>NR : the INDEX of the imported mail where NR is a value between 0 and COUNT-1

The same extension could be implemented to MAILEXPORT as well, as it can help, for example, to delete or change status of exported mails.


Moved from SF:
https://sourceforge.net/tracker/?func=detail&aid=2860257&group_id=13560&atid=363560

Attachments (0)

Change History (11)

comment:1 Changed 4 years ago by damato

In the meantime, I found a workaround so that the 'preserve mail status of imported mails' will work even with YAM 2.5. In the 'import' folder (made the current one for the process), all the mails are read with MAILINFO, and each MSGID in kept in a stem. After each MAILIMPORT, all the mails are checked again to find which MSGID is (are) newer. Then, the newer (imported) mail is made current, and its status can be restored with MAILSTATUS.

Not very nice as a solution, as it involves many loops (so slower in ARexx), but it works with the current stable and dev version of YAM. So the feature requested is still welcome, but I lowered the priority level to 4.


Moved from SF. Original poster: amigaphil

comment:2 Changed 4 years ago by damato

(Sorry to ask a question here, but I got no reply to my subscription request for the user list.)

The "workaround" I explained in my previous comment (checking all MSGID to find the newer one) is barely acceptable when importing only a few mails, but is a PITA when importing hundreds mails (the script run almost exponentially slower, depending of the sort order of the mails in the import folder).

Another approach which sounds way much better is :

  1. NEWMAILFILE to get the futur filename of a new mail,
  2. MAILIMPORT to import one mail,
  3. SETMAILFILE to make the imported mail the current one,
  4. MAILSTATUS to change the status of that mail.

Now the question is: Is it safe ? Can I rely that the filename returned by NEWMAILFILE will for sure be the one of the imported mail ? (If so, it will solve the problem I'm faced with and I'll close/delete this feature request.)


Moved from SF. Original poster: amigaphil

comment:3 Changed 4 years ago by damato

Can I rely that the filename returned by NEWMAILFILE will for sure be the one of the imported mail ?

That looked too good to be true :-( The filename of the imported mail is NOT the filename returned by NEWMAILFILE.

Back to first step, the feature requested for MAILIMPORT / MAILEXPORT still is the most convenient solution (those commands could return the filename instead of the index if it is easier to implement).

Alternatively, a new command like SimpleMail's MAILADD would help as well.


Moved from SF. Original poster: amigaphil

comment:4 Changed 4 years ago by damato

Yet another method, so far the best one:

Instead of exporting first the mails in a temp. mbox file before importing them in YAM with MAILIMPORT, the mails are now written straight in the destination folder, with a filename given by NEWMAILFILE. The status of the mails are restored/changed by modifying the filename extension (,R ,N). After all the mails are imported, the script do a MAILUPDATE to re-build the folder index.

This method is the fastest one. No need to deal with LISTSELECT or SETMAIL to change the status of the imported mails. The script will work under YAM 2.5 and YAM 2.6. The only inconvenient is that after a MAILUPDATE, the N (new) status a mail might have is lost (I'll post a request about this for 2.6). Also, if the filename structure change again in the future, the script might not work anymore.

(As the issue of 'preserving the status of imported mails' is now almost solved, I lower the priority of this request to 2.)


Moved from SF. Original poster: amigaphil

comment:5 Changed 4 years ago by damato

  • Owner set to damato
  • Status changed from new to accepted

Re-considering this again. But instead of returning INDEX, it would be even more useful if MAILIMPORT could return a list of FILENAMEs (as returned by NEWMAILFILE).

stem.FILENAME.COUNT
stem.FILENAME.0 
... 
stem.FILENAME.NR

So that those filenames could be used with MAILSTATUS (to be extended as well to use a FILENAME argument) to change/restore the status of the imported mails.

(See Support request #2912954 - "Import" Arexx scripts - testing request https://sourceforge.net/tracker/?func=detail&aid=2912954&group_id=13560&atid=213560)


Moved from SF. Original poster: amigaphil

comment:6 Changed 4 years ago by damato

(Just change the title of this artifact to reflect my last posted
comment.)

Instead of returning INDEX, it would be even more useful if MAILIMPORT
could return a list of FILENAMEs (as returned by NEWMAILFILE).
stem.FILENAME.COUNT
stem.FILENAME.0
...
stem.FILENAME.NR

(Related: FILENAME as input argument for MAILSTATUS
https://sourceforge.net/tracker/?func=detail&aid=2928409&group_id=13560&atid=363560)


Moved from SF. Original poster: amigaphil

comment:7 Changed 4 years ago by damato

  • Component changed from stable build to ARexx interface

comment:8 Changed 4 years ago by damato

  • Reporter changed from amigaphil@… to AmigaPhil

comment:9 Changed 4 years ago by damato

  • Owner damato deleted

comment:10 Changed 15 months ago by damato

  • Cc yamos-svn@… removed
  • Description modified (diff)
  • Milestone set to YAM 2.9

comment:11 Changed 10 months ago by damato

  • Milestone changed from YAM 2.9 to YAM future release

Add Comment

Modify Ticket

Action
as accepted .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.

This list contains all users that will be notified about changes made to this ticket.

These roles will be notified: Reporter, Owner, Subscriber

  • Philippe Duchenne(Reporter)