1

Using bash mailx or any other programs, would be a way to extract information from an email box and to write the specific information to a file?

Anyone has a clue about this, I have bunch of emails with tracking notifications every day, I would like to extract just the order no and the tracking no, and later to put that information to a FTP, but my problem is how can i extract that kind of information from an email box?

Svan
  • 11
  • 1
  • What format of your mailbox? Is it `maildir` or `mailbox`(aka Mbox) ? – Alex Feb 10 '17 at 10:22
  • Hi Alex, maildir I believe. – Svan Feb 10 '17 at 11:50
  • Please note that https://superuser.com is not a free script/code writing service. If you tell us what you have tried so far (include the scripts/code you are already using) and where you are stuck then we can try to help with specific problems. You should also read [How do I ask a good question?](https://superuser.com/help/how-to-ask). – DavidPostill Feb 10 '17 at 12:05
  • @Svan you can use `munpack` or `ripmime` to extract content from maildir files but parsing it I think it would be a challenge because ebay inconsistent with email format they are sending, it could be a plain text but recently they sending emails as html with links to tracking number that has also has embedded codes for user tracking which are a random – Alex Feb 10 '17 at 12:18
  • If you *receive* tracking notification email regularly, use `procmail` to filter and process mail when it arrives. You can use `formail` to manipulate header/body of a single mail. I'm not to familiar with [maildir](https://en.wikipedia.org/wiki/Maildir), but if it's just a file for each message, use `find` etc. to go through all files. – dirkt Feb 10 '17 at 13:36
  • @dirkt `Maildir` format is kinda obfuscated, like this `=09=09=09=09=09=09Shipping service : USPS Retail Ground`, so body of message might be extracted first to parse it in convenient way – Alex Feb 12 '17 at 22:53

0 Answers0