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?
What format of your mailbox? Is it
maildir
ormailbox
(aka Mbox) ? – Alex – 2017-02-10T10:22:04.823Hi Alex, maildir I believe. – Svan – 2017-02-10T11:50:08.457
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?.
– DavidPostill – 2017-02-10T12:05:46.113@Svan you can use
munpack
orripmime
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 – 2017-02-10T12:18:27.613If you receive tracking notification email regularly, use
– dirkt – 2017-02-10T13:36:06.327procmail
to filter and process mail when it arrives. You can useformail
to manipulate header/body of a single mail. I'm not to familiar with maildir, but if it's just a file for each message, usefind
etc. to go through all files.@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 – 2017-02-12T22:53:14.817