• How to find attachment name to use in read --detach-file=ARG

    By Alan Jacobs1 4 years ago

    How do I find the name of attachments in an email so that I can then use the read –detach-file=ARG to get the named attachment?

    I believe the name is held within the $FILE field and is called File Name: but I can't see any way to get it nor how multiple entries might be stored.

    Is the only option to do a detach-all and then examine what files appear?

    • By Sami Salkosuo 4 years ago

      You could use list-command or today-command to list emails, These commands print out only time, sender, subject and also attachment file names.

      There's also –fieldvalues option in read-command that prints out field value. But it doesn't work as planned. I fix it in the next version.

      • By Alan Jacobs1 4 years ago

        I'd tried the -fieldvalues but could only see the top level $FILE and not the attachment name underneath it.

    • By Sami Salkosuo 4 years ago

      I updated new version 5.2.2 and read-command now has –attachments option to print attachment names.

      You can also use today-command or list-command and –output-format=a option to list only attachments.
      For example:
      clenotes.cmd –output-format=!a today
      prints attachments names of all mails received today.

      • By Alan Jacobs1 4 years ago

        That's brilliant, many thanks!