 Hello and welcome to this video by Films by Chris. I'm Chris, that's Chris of the K, there's a link in the description of my website. And today we're kind of continuing. In the last video we looked at M unpack to extract attachments and messages from a mailbox file, an email file. But there was one issue with M unpack is that it doesn't recognize multiple messages in one mailbox file, which is fairly common. Again, this can be used for if you filter your emails you can run scripts on them such as I do to extract or do certain things to certain emails. For example, I get my pay stubs from work through email. So it makes it very easy for me to write a script when an email comes in from a certain address with a certain subject. It will take it, find that PDF and then sort it away for me so that I have all my pay stubs not only in an email, but manually or automatically put into a file on my computer which can be transferred to my server automatically. And that way I don't have to manually go into each email and go open PDF, save PDF, blah, blah, blah. And again, we looked at M unpack which only allowed you to access one mailbox file or one message in a mailbox file and it's common for mailbox files to have multiple messages in them. One example is this, and I haven't actually tested it with this but it should work is if you use Gmail, Gmail or Google allows you to use Google Takeout to pull down all your files. And with one click they will send you every email you have saved in your Gmail in one inbox file. So you can have a copy of that. So let's say you had hundreds of messages and you wanted to pull down all the attachments from that. You could either go to Gmail, click on each email, click on each attachment and save each attachment or you can use that Google Takeout, pull down that one inbox file and use the program we're going to be looking at today which is RIPmine. And it should be in your package manager so I'm going to search, aptude search, aptude is just the package manager I'm using and I can search for RIPmine. I'm sorry, I put an extra E in there. And I just installed it so it should be showing up. Am I spelling something wrong? Oh, mine, I'm doing mine. That's funny. Okay. There we go. There it is. And as you can see I already have it installed. Use your package manager to install apt, install or aptude, install RIPmine. And as you can see, it's an extract, an attachment, extract attachments out of a mime which we talked about in last video, stands for something, internet, something. Anyway, it's the emails and again real quick we'll look at this inbox file which again has three messages in it and this is what an inbox file, this is what an email looks like and again the attachments are sent as base 64 so they're plain text like this and that's why you need a program like this, you can either manually find the base 64, you can write a script that looks for that, looks for the attachment name and file type and then converts it and say it but you don't have to do all that. This RIPmine is going to do this for you and all you have to do is once you have it installed is RIPmine-i and give it the mailbox file name and again the mailbox file will be called whatever you want, I called mine toot because this is for this tutorial, it's not like a fart and sometimes they have the dot inbox extension, sometimes it's dot mail, sometimes it's dot, it doesn't matter because it's plain text file but that dash i will extract all those files and as you can see here they are, I have some so I can text dg dash open this directory and you can see I have some images in here of my kids, a pdf and then you have a bunch of text files, one of the attachments is text file, the rest of these text files are actually the email messages so if I was to cat out text file and all the text files you can see it has the text from the emails and the html from the email so you have the messages so an example here is a pdf file, please read it and again it has the html in there but you can also see it in the plain text format up here because it saves both as we talked about in the previous video when you send a message that's formatted in email it's going to be sending it with the html that is format but it also sends a plain text copy of that and all that junk so that's one simple way to extract all your attachments and messages now that put that in our current running directory you know our directory that we're currently in but if I wanted to make I'll create a directory called output or you can call the attachments or emails whatever you want I can run the same command rip mine and give it dash dash dash dash dash d yes so I'll say dash i that and dash d and I can say output so dash d is the directory you want to put all the attachments to so now if I list out the output directory you can see those files are now put in there if I run the file I have a question here if I run this again okay it looks like it either okay so if you've already run it once it's going to add an underscore one so if I run it again it's gonna add underscore two to those I would assume yep so keep that in mind if we check out the man page for this let's see if there is an a a overwrite so yeah there's a dash dash overwrite option so and there's a lot more options in here we're just looking at the basic functionality you can overwrite stuff you can also you know set prefixes for names you can do standard input and pipe stuff to this program let's run the same command again if I was to run this it would it would create more so so we have dot or underscore two was the last one I would think that if we add dash dash overwrite it will yeah so over it the first copy so again I can do that and then dash D and the output folder and we can then list out what's in the output folder and there shouldn't be more than one copy of each file in there and again we have a PDF for one attachment we had one email that had three images png's and jpegs so this ripmime does a great job of going through all the emails in one inbox file extracting not only attachments but the messages and putting them into files as well so this is a very very easy way to get all attachments pulled out of an inbox file and that could be very useful for scripting as I've talked about in the last three hours talked about how the postal service sends me an email every morning with images of all my my letters my snail mail letters they're going to go into my mailbox and I actually have a script when that email comes in it rips out all the images and then puts them in a directory on my web server and I have a link to that directory as a gallery on my phone so every morning I just open up my phone click on one icon and I see images of all the letters that are coming to me that day which is nice to know what's coming in especially if you're waiting for a check or something like that and then also you know it lets you know oh I was supposed to get a check in the mail I saw the picture of it and you got to your mailbox and it's not there that allows you to know that hey it is either delivered to the wrong address or someone stole it and you can report it and hopefully find out what's going on rather than being not knowing whether the check was supposed to be there or not so it's very useful for a lot of things and with these days when you can filter all your emails into different labels or even mailbox files it makes very easy to script things out and automate stuff like that so again I thank you for watching I hope you do find this useful I'm Chris that's KRIS of filmsbychris.com link in the description as well as link to patreon.com forward slash mail x1000 which is one way you can support me you can also go to filmsbychris.com and go to the support section there's a link at the top of the page which will give you a link to the patreon page and then there's also a link to a paypal payment so if you want to do like one time or a casual payment use the paypal option and I do appreciate you watching liking share and subscribing and supporting thanks for watching as always I hope that you have a great day