Download and extract information from emails in gmail - email

I want to download mails from all items and do some analysis on the mails. this will probably involve 2 distinct components.
download the mails using IMAP
parse unstructured data in the emails to extract information from them. no - its no the usual extract email adresses from the mails. probably quite a bit more complex than that.
i imagine a step involved would be converting it from MIME format to pure text. the parsing can probably be done after dumping all the emails into a database, but i dont want to lose any formatting or attachments present in the mail.
i would prefer to do it in .net, but am open to the best language tools available for the kind of work involved. have heard that perl is probably the best option for this kind of analysis.
thanks in advance

I actually just finished up a project very similar to this. I used WebDAV and .Net to accomplish this. I actually found a post on SO that was very very helpful: Read MS Exchange email in C#

Related

What is the best way to programmatically extract text from an email from a additional inbox?

I recently started working at an IT company as a support agent and one of the things we do is managing the backup of our clients' servers.
It's all working nicely, but one part is just terrible, which is the backup log. The backup log is a excel file with a list of all the clients and for each of them a list of dates and whether or not the backup has succeeded on that date. The data in that document comes from emails rapports that are automatically sent when the backup finishes.
But here comes the bad part: Once in a week there is an employee who checks ALL THE EMAILS and manually fills the backup log. This was too much for me, especially knowing that we only have about 5 employees.
Solution: Make a script that does it for you. Yeah, I know and I think I'm capable of doing that, but there's a few things that I'm not sure about and I hope you guys could help me with it:
The mails are all in a different folders in an inbox that I had to add to my outlook manually and I don't know how I can programmatically reach it.
I don't know in what language I should use for this. I'm able to do it in a lot of languages, but I don't know which one suits this best
These are the only two things that I don't know and I would really appreciate it if you could help me with this.
EDIT:
The server is an exchange server with IMAP enabled. I eat java for breakfast and I've used JavaMail before, so I think I'll go with that, thanks
This is a pretty open-ended question....
You should pick a language that you're comfortable with and that has a good email support library, e.g., JavaMail for Java.
If the messages are in an Exchange server that has enabled IMAP support, you should be able to read the messages using JavaMail or any other library that support IMAP. If the server only supports the Microsoft proprietary protocol, you have fewer choices.
We really need to know more about the mail server you're using to offer much more guidance.

SNDSMTPEMM NOTE Limited to 400 Characters

I am trying to get our iSeries 6.1 machine to send email through our Exchange server. I can do it with SNDDST and with SNDSMTPEMM, but both are very limiting. I need support for basic HTML, and for PDF attachments. I thought I could get them both from SNDSMTPEMM, but now I see that the body parameter for SNDSMTPEMM (NOTE) is limited to 400 characters. Is it possible that this command allows 10 attachments but less than a paragraph of text?
I would like to know if anyone is using this command, and if I am missing something about it that would allow me to create an actual email message.
If indeed I can't put more than 400 characters into the body of an email with this command, I have read about MMAIL and MAILTOOL and I am curious if anyone knows if this message length restriction exists for those as well?
It will be a very hard sell for our main programmer to install any third-party anything to get this working, so I would love to be able to do it with SNDDST of SNDSMTPEMM (or some other built in I haven't found yet).
I don't currently need to be able to send to multiple recipients, but I do need to be able to attach a couple of attachments (where SNDDST fails for me). I also can't use attachments with an *LMSG.
I'm sorry if this is the wrong place for this kind of post - I find it very difficult to find the right place.
The SNDSMTPEMM command is indeed limited to 400 characters in the message body, according to the documentation.
Where I work, we still mainly use MMAIL, which used to be free but now requires a $50 "donation" (and lots of hoops to jump through just to register). It doesn't have that message length limitation. It comes with several commands for ease of use, and a service program for more fine-grained control over how the message is built. Once you download it, you have access to the source, so you can really muck around with it if you have to. (The donation also allows you to download a multitude of other utilities from Easy400.net.)
A better but more expensive option is Bradley Stone's MAILTOOL. It's still competitively priced, as far as commercial IBM midrange software goes. If you go that route, it's probably worth getting the Plus! add-on, which side-steps IBM's native SMTP, a recurring source of headaches. (MMAIL and the basic MAILTOOL rely on native SMTP.)
The best place for this kind of post, at least for now, is the Midrange-L mailing list at midrange.com. When it comes to AS/400, iSeries, and IBM i stuff, that community is currently much more active than Stack Overflow, and they welcome open-ended discussion and "what do you recommend?" posts, which are discouraged here. You can find some discussion on the command you mentioned, and some alternatives, in this thread.

Outlook Emails to assigning database

I'm def not looking for someone to do this project for me, just bouncing off some ideas with a guru or two.
I have emails going into a global box that is shared by a few employees. I need to find a better way to assign the work out. In the past, it was grab and go. Today, an employee assigns the work out.
I'm trying to find a simple way using maybe Excel or Access, that I could copy/drag the email and it would provide who should work it and how much work they have done by week/month/year.
It's not possible to use an inhouse ticketing system, because it is non employees that send mail to this inbox, so they would not have access to using the in house ticketing system.
Would it be easily possible to design something like this or is this a more daunting task? What software would you recommend or method would you use?
Thanks for your time.
I recommend converting emails to Tickets, using a CRM/ticketing system with such feature. It would save you the hassle of developing and mantaining custom code, for a commom feature needed not only by you, but many other firms:
A quick search for "convert emails to tickets" yielded:
https://wiki.vtiger.com/index.php/Mail_Converter
http://community.geminiplatform.com/blogs/15/how-to-convert-emails-to-tickets-with-gemini
Both vTiger and Gemini are free to use.

Reading email in MS Outlook

this one is of clumsy implementation type and I have small knowledge about MS products.
Task: Access MS Exchange Server (outlook or whatever) and parse all unread emails with specific sent date, subject, from address. Certain data should be saved during parsing (like a flag/boolean array or something similar)
Requirements: should be done either through scripting language (no matter which one, looks like VBS suits this task) or any other method that will be able to perform slight analysis and return an exit code and a message (I'm thinking about web services that might exist in OWA, or any thing else).
Thanks in advance.
Use a driver or dll for you language of choice, I know C# / VB have libraries to accomplish this. A web server is fine if its going to not be a headache setting up access between servers, or if its on the same box with permissions.
Should do the trick, I would personally use C# as it would make this incredibly easy with the .net libraries and OLEDrivers.

Best method to write an email poller

I am working on an email polling solution, for a multi-user system. So users can send emails on their respective ids and it would be polled and inserted to a db.
There are two options that I am considering:
Perl/Unix based email pollers..
A java based poller.
What would you recommend.. (other suggestions are also welcome)
Instead of polling, why don't you forward the mail to a process? Depending on the mail server you use, you can do that as an alias or even in the .forward file.
I've nothing much to add to this, but there's currently a project at google code to rebuild iwantsandy.com as open source.
It's at:
http://code.google.com/p/sandysback/
I'm definitely going to be watching this to see how they parse emails, and have those emails "inserted into a db"
Whichever language you have most experience in!
I personally know java and perl well and for this task I would choose perl but the differneces are marginal.
Perl would be shorter and sweeter, java would be take longer but probably be a more robust solution once the database access is sorted out.
I find Perl DBI is a better and more portable database interface than JDBC which does not hide database implementations from your code and is sensitive to version changes etc. I.E. you must have the right version of the right database driver for your target database.
RE: Poling
If you have the option to forward the email to a process I would highly recommended you do that. (Forwarding generally puts less load on the server than poling does.) If not, then poling is the next best thing. Look into the POP3 client libraries on whichever language you are most comfortable with.
RE: Language choice
If I intended to do a lot of parsing of the emails then Perl would be my choice. If not much parsing is involved then Java would be the way to go for me ;-).
-- In a former life I wrote a Perl script to parse (well structured) incoming emails into HTML pages and post them to a web server.
You have a couple of options. As the orginal poster said - probably the simplest way is to set up an entry in the aliases file to a script.
Then the body of the email gets passed as standard input to the script. You can then use a perl script + Mime modules to parse out the bits of the message and do whatever you want with it.
One might also look at apache james - which is a custom mail server. They have the equivilent of servlets, called 'maillets' that you put your business logic in. They often hard to deploy in enterprise scenario's though as most companies don't like having custom mailservers being deployed.
... the aliases route is probably your best bet. one other note of caution - email isn't gauranteed. if you are using this as some sort of app to app messaging system, and you control both ends, you should probably look at something else, like JMS type messaging.
-Ace