I have an email account (like gmail or something) that gets a daily email with a file attached to it that has some data in it. Is there a way to have a program check the email everyday, say at midnight or something, download that file, and store the contents into a SQL database?
I'm familiar with Java, JavaScript, PHP, HTML, and Python. Is there a way to do this using what I already know, or would it require some other technology?
I like to use Python for this kind of tasks, it's fast and minimalistic.
You can access mails using POP3 or IMAP protocol. Python contains modules to work with them: poplib and imaplib. POP3 is simpler, I advice to use it if you need just download mails and delete them after that.
IMAP is more advanced. Each message has it's own UID, that identifies messages. New messages have greater UID then old one, so every time you run downloading, you just need to store somewhere (in file, database) the greatest UID of messages you processed and use it to find newer messages when you will run downloading next time. See here example of working with IMAP from Python.
To schedule downloading each X hours, you can choose from these options:
Write application that download new messages, then sleep using sleep() function in infinite loop.
Write application that just download new messages and finish its work. Schedule its runs externally using Cron tool.
I developed such a solution in C# with Pop3client, don't know if it is the best though.
Here is an example doing it in Java:
pop3-client tutorial
Related
I have a client who wants me to automate certain document processing work.
There is this pdf that can only be opened by sending in username and password to a DRM server.
When I open it using Acrobat, I see this.
I have the username and password, courtesy of the client.
Issue is how do I automate this?
I have done web scraping before, where I automate a web login so that I can execute certain routine tasks.
But this is the first time I am trying to automate an authentication that does not occur inside the browser.
How do I go about doing this?
Companies pay a lot of money to do exactly not this. http://www.adobe.com/devnet/reader/topic_drm.html. I suspect the amount of effort to do this will not be worth it, especially if you are going to try and dive into the actual protocols/plugins used and hook in directly. This would be very implementations specific and likely to break in the future.
Your best bet is to leverage the existing Adobe Application and wrap it in an Automator script. Unfortunately, OSX specific.
They won't have generic workflow hooks, so the quick and nasty way would be to just record yourself doing it once, and play it back time and time again.
Workflow:
Drag PDF onto custom app
Automatically populate username
Automatically populate password
If you are looking for somewhere to start: http://www.macosxautomation.com/automator/features/virtual-user.html
The DRM module itself can set permissions about how you can print and re-distribute the files itself, you won't be able to get around any of that, but assuming you have all the permissions set correctly, you should at least be able to automate opening the file itself on OSX.
Is it possible to add server logic in QuickBlox? For example, I want to send a message to all existing chat rooms in my app every 20 - 30 seconds. The only way I see now is to place my program on another server, that will register as another user and connect to all existing rooms, sending messages. Is there any other way? Thanks.
There is no way to upload custom code to QuickBlox server now,
As a workaround - write simple script (in python, ruby) which will do that, upload it to some server (or home PC), run it on CRON. Does it work for you?
I am working on a study that sends people a PDF document with information about their health. The team would like to know if the person has actually opened the PDF document (a sign that they didn't just ignore the e-mail). I know that it'd be possible to do it with a link to an external file, but the users are much less likely to click on a URL and download it then they are to just view an attachment, and we don't want to do anything that might prevent the users from reading the information (we've already had people say they never received the message, and with further investigation they discovered they had, they had just ignored it).
Another option is to request a read report, but this is only useful if it doesn't annoy the user (ie it does it automatically when the email is opened instead of requesting them to send one). We're currently looking into this as well, but the ability to check if the attachment has been opened is a much better idea.
The email is generated in MS SQL and sent using the database mail system, and we have adobe acrobat pro, so creating scripts in pdfs is possible (although I'm not sure whether those scripts will be allowed to run).
Thanks
1) Dont include the PDF in the email, include a link to the PDF.
or
2) Include a javascript snippet in the PDF, which hits a per-user URL or includes IP address or something to track. This will only work if the user allows javascript, and if their pdf reader supports it.
See
http://ask.metafilter.com/153206/Is-it-possible-to-track-where-a-PDF-file-goes-once-in-the-wild
Since this was originally posted there has been a number of consumer tools that now let you track PDF's sent via a web link.
http://docsend.com , http://attach.io
and if you're sharing from Dropbox
http://orangedox.com
Much easier than having to script it yourself
At this time there are a number of tools available who offer attachment tracking service to their users. I am also using SalesHandy for attachment tracking and get the deep analysis of when & where your attachment is open.
Click to read more: https://www.saleshandy.com/document-tracking/
Where do I start?
Is there some sort of API - or something I can get access to that allows me to format articles and send them to my kindle?
I would like to do this in Rails.
Edit: For further clarity, I guess my real question is, how does instapaper.com get articles from the web to my kindle? Can someone explain the technology behind that please and do they have access to the Kindle SDK?
Take a look at Calibre (http://calibre-ebook.com/), runs on Linux, Win and OS X. Python based, has a GUI and a command line, suitable for automation. You can do all kind of conversions to .mobi format as well as fetching news from website and packing it to .mobi, which can be then transferred via USB or sent to kindle email address. It's very simple to fetch & send articles automatically either on a server system with cron or leaving it running on desktop (with GUI) for non-technical users.
Calibre's command line tools are your best bet: http://calibre-ebook.com/user_manual/cli/ebook-convert.html is the call you would most likely be interested in.
I believe all Instapaper does is convert to .mobi format, and then send mail (with the .mobi file attached) to your specified Kindle email address (eg. foo#kindle.com).
If you're more interested in specifics, Marco (Instapaper's author) tends to be very forthcoming when people ask him technical questions. His Twitter account is #marcoarment.
Check out this ruby gem, it seems to do what you want:
https://github.com/29decibel/kindler
Hi I am new to MAC OS development and I want to send an email programmatically trough an application, but without using Mail app like in SBSendEmail from apple's site. I dont want to attach any attachments, just a plain text email. What is the best and easiest way to do this? is it possible to use the basic functionality from SBSendEmail and automate the last step of sending mail through MAil app? Is there no easy way just like in C# to create a mail object and just send it?
Thank you.
There's no way to do this in pure Cocoa, except to use one of the three or four email libraries available (Pantomime is one I know of off the top of my head). The main problem with all of these is that they're designed for implementing a full email client, not just sending email, so they're probably more heavyweight than you need.
For Growl's MailMe display, I wrote a command-line mail-sending tool in Python. The Xcode project bundles this into the MailMe display plug-in bundle, and MailMe runs the tool using NSTask, passing the SMTP info it finds in the user's Mail preferences. Growl is also open source, so you can read the source to the MailMe display.
Things that won't work:
The Message framework, which has no public API in 64-bit.
The mail(1) tool, which requires the user to have the local SMTP server running (simple-mailer uses another SMTP server, whose name you pass in on the command line).
Note that MailMe currently does not understand how to look up MobileMe passwords, so it isn't yet able to send using MobileMe accounts. If you amend the code to do this, we'd appreciate a patch!
Another patch opportunity is that MailMe currently only looks in Mail's preferences for mail-sending settings. It could look in other clients' preferences, but does not yet know how to do that. If anyone who uses Thunderbird would like this capability, again, we'd appreciate a patch.
I would suggest you make use of /usr/lib/sendmail if present. Open a pipe to /usr/lib/sendmail and send the mail on stdin. This should be available the OS.