Node Imap - How to find and save emails and their attachments - node.js

While using this module Node imap I wonder how to download not only the emails but also the attachments. Nowhere to be found some simple example that shows how to do this.

Based on an example provided by the module author, I managed to put together some code that fetches the unread messages and then gets the content plus the attachments.
Couldn't find a full example of what I needed anywhere; It's far from perfect, I have some trouble dealing with async processes, so it can certainly be improved.
Hope it's of some use to somebody
Code in pastebin

Related

Gmail markup for online event

While there is good documentation around sending markup emails for specifying offline event. Refrence Can someone help me out on how to add handle an online event?
The issue with offline event is that I need to enter a proper postal address, however in our case the location is simply a url.
Things I have already tried
Putting type of location as VirtualLocation, but that gives error
Entering empty strings in PostalAddress fields
Marking eventAttendanceMode as https://schema.org/OnlineEventAttendanceMode, it gives error
Does gmail support markups for online events? Common sense says it should.
As said by #kayes-fahim comment you can find more information on their blog, and documentation.
By the blog post you could use the virtualLocation but you also need to set the eventAttendanceMode to OnlineEventAttendanceMode. Reference

Lotusscript logic for repeating calendar options, but in separate app

I need to use the "repeat options" subform in the mail file in an application that tracks our implementations.
I have looked at the code behind this in the mail file, but it is way too complex for my needs, as I just want the whole logic on how to get the various dates/times I need to create a document for. I have seen some calls to a method, generateRepeatDatesExt(), but I did a search and couldn't find any trace of it.
Anyone knows where that thing is hidden? Or better, anyone has a sample app that creates repeating dates that use the repeat options found in the mail file?
Any help, pointers, samples are welcomed!!!
Thanks a lot...
I found a really nice demo application that does exactly what I need, and it was done by Julian Robichaux a while back. Details and sample file can be found here: http://www.nsftools.com/tips/NotesTips.htm#repeatdates

Python Gmail Attachment

After reading this question I ran the script:
How can I download all emails with attachments from Gmail?.
For some reason, not all my labels or messages with attachments are downloading. I think it's either there is a problem with identifying the labels or that I have seven gmail accounts that I sent out. For example my main one is example1#gmail.com but I can send mail as example_2#gmail.com from example1#gmail.com
I did find gmailbackup (another python module) and have it running currently. The problem is that it doesn't download attachments that I've been able to find in the documentation and in the program. I am trying to jerry rig these two source codes together, but I am having problems in reading and understanding the script of gmailbackup.
So the problem was with the m.select() function. The m.list() function does not make a list for you to query for each label.
So I added these lines:
m.list()
inboxes = list(m.list())
for item in inboxes[1]:
mailbox = item.split('"')[3]
m.select(mailbox) # here you a can choose a mail box like INBOX instead
There are probably better and more efficient ways of doing this, however I was in a hurry. Using re and matches module would probably be great to build in.
Edit:
There is a second way of applying a filter that adds the label attached to anything attached and downloading from that label.
Edit 2
Gmail has a limit to downloads per day, so if you are dealing with large emails you might want to track what you have already downloaded.

Postfix - all attachment extraction at the server side

How can I extract all the attachments coming to the postfix email server? in order to save it to another (efficient) file server. I don't want to log in for every user and extract the attachments for the individual users but extract all the attachments (as file objects or file stream) as it comes to the postfix server and save it. While extracting, the routine should know which user an attachment belong but it should not go by user way. I specially want to avoid the login session/cycle.
As the second option - if I can get a push notification about a users attachment as it arrives. I am sure there are ways to do that - please let me know best ways to do it. And then extract attachment(s) for the user whose email with attachment(s) has just arrived. Still, I don't want log-in/out cycle to extract. It has to be done such a way that no individual password would be necessary.
Guessing lot of solutions would come in in python, thats great though. It would be also helpful if I get some NodeJS solution to do this.
Please help, and don't mix your solution with these two options - one at a time solution please - either one :)
Have a thorough google for postfix, procmail and uudeview - That combo will allow you to save attachments on a file server.
As a starting point have a look here:
https://kuther.net/howtos/howto-receive-mail-and-save-attachment-fetchmail-procmail-and-metamail
...and here...
http://www.mugginsoft.com/content/postfix-automatically-decode-zipped-attachments
HTH
Regards
Frank

How to parse nquad document

I'm interested in parsing out names of places from DBPedia's nquad document. Here's a preview: http://downloads.dbpedia.org/preview.php?file=3.8_sl_en_sl_geo_coordinates_en.nq.bz2
I've looked on Google, but haven't been able to find anything. Any suggestions? I'd prefer a nodejs module (so I can go through the code), but any tool works.

Resources