I am looking for an easy way to parse an IMAP struct that I have read from an exiting email account. Ideally if you could point me to an existing gem that handles imap emails. Everything I find is extremely old.
My app fetches email from an existing, external imap account. I am able to read the email and retrieve it and even to parse it and extract most of the information I want. However, I am not able to extract the HTML or text body parts easily. Overall, parsing the struct that is returned by the net/imap library is difficult to handle.
All the help articles that I can find on the topic seem VERY old and existing gems have not been updated in many years.
Is there not an easy way, a gem or built in library to handle imap objects? I am also open t rewriting my app to do things easier. My code below is workig fine. The envelopes struct that I receive back is just really awful to work with.
connection = Net::IMAP.new(server.inbound_server, server.inbound_port, server.inbound_encryption)
connection.login(server.inbound_user, server.inbound_password)
connection.examine("INBOX")
uid_list = connection.search(["FROM", search_term])
envelopes = connection.fetch(uid_list, "ENVELOPE")
Related
i implemented a chat app in swift using firebase real time db, there user can send images, emojis and Text.Now i have a requirement of export chat or get the conversation's backup with media and text as per whatsApp.help me to solving it out.
While Firebase offers a backup for the Realtime Database, this doesn't fit your needs here, since you'll want a per-user export of the data.
Since this is specific to your application, you will have to code it yourself, just like the good folks at WhatsApp have probably done. It should be a matter of iterating over all data sources for the user, getting the data through the relevant API (that you're already using to display that data), and then writing to a local file). You can do this either client-side in your Swift code, or server-side on a server you already may have, or using Cloud Functions.
If you're looking for some inspiration for the latter, there is a sample repository that shows how to clean up a user's data, based on a set of wipe-out rules. You'll need to significantly modify this example though, so I'm not convinced this will be less work than rolling your own from scratch.
I've been using Stackoverflow for about 5 years now, and haven't felt the need to ask a single question yet, I've always found the answer i needed through previous threads. That just changed and I have a question that I really can't figure out. And it sounds so easy to do.
So the question is; how do you invite attendees, or reply/decline to calendar events on iOS under iOS 10? And please, no we don't want to bring up an EKEventViewController. We'd like to do this in our own UI. Under iOS 9 this was possible through just forcing EKAttendees objects in to the EKParticipants array with setValueForKey:. But under iOS 10 this produces an error saying 'Attendees can't be modified'.
I have used a Technical Support credit with Apple and got the reply that this was not possible. It is not possible using their APIs.
The closest to an answer i've got is to use IMIP (https://www.rfc-editor.org/rfc/rfc6047#section-2.2.1). If that's the way to go, could someone help me along on how to actually set that up? I'm not well versed in back-end development, I'm all front-end so I wouldn't really know where to start.
There also seems to be some CalDav servers on GitHub (https://github.com/mozilla-b2g/caldav) but I'm not sure how good they are, or exactly what you need to set one up.
So basically, is there anyone who could give a childs explanation to just how the heck we can send nice invites to calendar events. And if there are different solutions for Google, Apple accounts (obviously under the hood, but implementation-wise) that would be very helpful to know to.
Is this something that requires a ton of implementation on our own servers or is there some reliable service to use? That would be ideal. Maybe you should build one and you got at least one customer here :-)
Appreciate any help!
You cannot modify attendees using EventKit, but Apple already told you that:
I have used a Technical Support credit with Apple and got the reply that this was not possible. It is not possible using their APIs.
The hack with accessing the internal objects using KVC was, well, a hack and not documented API. No surprise they killed that.
So how do calendar invites work. That in itself is a very complex topic (consider delegation, resource booking like rooms, etc etc). There is a whole consortium which works on that (CalConnect), they also have a broad overview: Introduction to Internet Calendaring and Scheduling.
If you are serious into scheduling/calendaring software, it may make a lot of sense to join CalConnect for their interop events etc.
But you wanted a 'childs explanation'. I can't give that, but a short overview.
iTIP
iTIP is a standard which defines how scheduling messages flow, e.g. that you send a message to your attendee, your attendee responds back with accept/decline, what happens if a meeting is cancelled and all that.
It does NOT however specify how those messages are transferred. It is just a model on how the message flow works between the organiser and the participants.
Most 'big' calendaring systems (Exchange, Google, CalDAV servers like iCloud) use iTIP or at least something very similar.
iMIP
iMIP is a standard which defines on how to exchange iTIP messages using email. Say if you invite someone using iMIP, you'll send him a special email message with the iCalendar payload containing the invite. If your attendee accepts, his client will send back another iCalendar payload via email containing that.
iMIP is supported by a lot of systems and was, for a long time, pretty much the only way to exchange invitations between different systems (say Outlook and Lotus Notes).
However: the iOS email client does NOT support iMIP (unlike macOS or Outlook). So if someone sends you an iMIP invite to your iOS device, you won't be able to respond to that. (reality is more complex, but basically it is like that)
CalDAV
CalDAV is a set of standards around calendars stored on a server. Many many servers support CalDAV. E.g. iCloud uses CalDAV. Yahoo, Google, etc all support CalDAV. The important exception is Exchange, which doesn't support it.
In its basic setup CalDAV just acts as a store. You can use HTTP to store (PUT) and retrieve (GET, etc) events and todos using the iCalendar format.
In addition many CalDAV servers (e.g. iCloud) do 'server side scheduling'. That is, if you store an event to the server which is a meeting (has attendee properties), the server will fan out the invitations. Either internally if the attendees live on the same server, or again using iMIP.
Exchange
Exchange supports iMIP but not CalDAV. You usually access it using one of its own web service APIs, e.g. ActiveSync or Exchange Web Services. I'm no expert on them, but I'm sure that they allow you to create invites. Exchange&Outlook have an iTIP like invite flow.
etc
Is this something that requires a ton of implementation on our own servers or is there some reliable service to use?
This really depends on your requirements and needs. Do you need to process replies or just send out generic events?
If you want to host a calendar store, it probably makes sense to use an existing CalDAV server.
Calendar invitations are a very complex topic and you need to be very specific on your actual requirements to find a solution. In general interoperable invitations in 2017 are still, lets say 'difficult'.
P.S.: Since you've been using StackOverflow for about 5 years now, you should know that this question is too broad for this thing.
According to this thread (and various hints in the source code like variable names) Indy supports fetching gmail labels but not setting or removing them. However, as of yet, this functionality appears to be undocumented. Can anyone help me with filling in the details about how to retrieve Gmail labels with Imap?
Which function(s) should I call to retrieve the labels and have Indy parse out the results for me? Although I could certainly manually call SendCmd() to request the labels ('C2 UID FETCH 92 (X-GM-LABELS)') similar to how I'm manually setting/removing labels (which Indy doesn't yet do), parsing FETCH results is something that I know is already built into Indy, so I don't want to re-invent the wheel here to decode the FETCH results. For now, to keep things simple, presume I just want the labels and not other envelopes/headers/message parts.
There do appear to be quite a few functions that might (or might not) be relevant, but with so many to choose from, and so many of them only having auto-generated documentation, figuring out which one to try, and which property (or sub-property) or function to find the actual labels is a little daunting. Can anyone point me in the right direction here?
Indy supports fetching gmail labels but not setting or removing them.
Not quite. TIdIMAP4 supports searching for emails by Gmail label, but does not yet support retrieving Gmail labels for specific emails.
However, as of yet, this functionality appears to be undocumented.
A lot of functionality added to Indy in the past several years is still undocumented.
Can anyone help me with filling in the details about how to retrieve Gmail labels with Imap?
Some GMail IMAP extensions added to TIdIMAP4
The TIdIMAP4SearchKey enum has been updated with new items to support the X-GM-RAW, X-GM-MSGID, X-GM-THRID, and X-GM-LABELS extensions in SEARCH commands issued by the SearchMailBox() and UIDSearchMailBox() methods.
The TIdIMAP4FetchDataItem enum has been updated with new items to support the X-GM-MSGID, X-GM-THRID, and X-GM-LABELS extensions in the FETCH command, however no TIdIMAP methods currently use these new items yet.
Support for the X-GM-LABELS extension in the STORE command has not been implemented yet.
Which function(s) should I call to retrieve the labels and have Indy parse out the results for me?
The only methods that support GMail labels at this time are TIdIMAP4.SearchMailBox() and TIdIMAP4.UIDSearchMailBox().
Although I could certainly manually call SendCmd() to request the labels ('C2 UID FETCH 92 (X-GM-LABELS)') similar to how I'm manually setting/removing labels (which Indy doesn't yet do), parsing FETCH results is something that I know is already built into Indy, so I don't want to re-invent the wheel here to decode the FETCH results.
Sorry, but you will have to. Although TIdIMAP4 does parse flags in FETCH responses, it discards any flag that is not supported by TIdMessageFlagsSet (Answered, Flagged, Deleted, Draft, Seen, Recent). So while Gmail labels can be parsed automatically, TIdIMAP4 has nowhere to save them yet.
Can anyone point me in the right direction here?
At this time, you have to implement it manually.
In the email notification we can see something like
<username> followed you using <appname>.
It is great. But is there any possible way to know the application name using API?
I took a look through the REST API, and I could not find anything that would support this. My guess is that this is a twitter.com feature that is available in the API (yet).
The most logical places I looked were statuses/followers and friendships/show. In both cases there was nothing definitive. Checking the follower emails for my account, I found multiple followers that used applications (like PeopleBrowr and SocialOomph) to follow the account. In most cases, the source on their latest status object matched the application name used to follow me, but that was definitely not a sure thing.
So, to answer your question directly, no I don't think it can be done through the API (not unless there's an undocumented method out there that does this.)
I can, however, think of a way to get that info. One approach would be to set up the email account receiving the follow notifications to forward a copy to a mailbox that is checked by an automated process. When emails show up, parse them to find the app name used to follow you.
I used the following regular expression (in C#) to find the application's name and URI in the email's body:
Match m = Regex.Match(input, #"followed you using\s*<a[^""]+""(?<appUri>[^""]+)""[^>]+>(?<appName>\w*)</a>");
I used m.Groups["appName"].Value to pull out the application name, and m.Groups["appUri"].Value to pull out the URI from the match.
In order to tie the app info to a user, I had to also find the screen name with:
Match m = Regex.Match(user, #"\(#<a[^>]+>(?<screenName>\w*)</a>\) is now following");
I used m.Groups["screenName"].Value to extract the value from the match.
Is there any ruby gem/ rails plugin available for parsing the resume and importing that information into an object/form ?
I may be wrong, but I don't think you'll find anything completely automated to do this, because a résumé (or CV) can be structured in so many different ways and can contain very different types of data. Any completely automated solution is likely to have accuracy problems, since it is technically a difficult problem to solve.
You may find this answer useful.
Here are some other suggestions that might help :-
Require a user to enter their details into a form on your website instead of uploading a Word document. You'll then be able to explicitly ask for the data you want and you'll be able to store the data in a structure that suits you. However, this may be too much of a barrier to entry for your users.
Allow a user to submit the URL of their résumé published using the hResume microformat. Sites like LinkedIn already publish résumés in this format. There is a Ruby gem mofo which can parse microformats including hResumes. However, not all users will have an on-line résumé like this.