Can an email be printed as soon as it enters the Inbox? - ruby-on-rails

We are working on an online food ordering application. When the user orders something from any restaurant, an email is sent to the restaurant's email address mentioning the order details. However, our client wants that an order print out should be generated automatically as soon as a new order is received.
Is it feasible using ROR? If not, any alternate solution to the problem?

When my group wrote something like this we went a little lower tech, and had the system generate a fax and send it to a fax machine at the restaurant. Of course, that's mainly because this was a system working across many restaurants, with disparate IT infrastructures, and the one thing they had in common was each had a fax machine.

I would figure this could be done in 1 of two ways:
1- Outlook event-- Outlook has the ability to set up 'rules', one of which I think allows printing.
2- Create a script that runs every few minutes, checks the email (either through IMAP, or POP, depending on the account), and prints all of them out.
See this: http://ruby.about.com/od/tasks/a/pop3.htm for info on how to check POP3 mail with ruby on rails.
For printing, the links mentioned here seem useful: http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/504a616bf3e28057/ff6cb91462dfe961?pli=1

Ensure that you have 'from' or 'subject' filters setup, otherwise there will be a lot of spam printing.

You can use software to print your order automatically when email is received, it supports also print attachment like pdf, word, etc...
It is used by a lot of restaurant to print online order:
http://www.automatic-email-manager.com/

Related

Any idea to archive emails in Conversations in Asana?

I would like to centralize every email from (or to) customers of a project in the Conversations view of a project in Asana. The goal is to keep an archive of all exchanges with a customer in one place for every team member.
I tried to use the project#mail.asana.com as CC in every emails that i send but customers don't have accounts on Asana (and i don't want them to access it) and so they can't save their replies in Conversations. I tried also to create an email group (in Google Apps) and add the Asana email at it but it didn't work.
Any idea to use the Conversations view as an archive ? Or maybe is there an external tool which integrate with Asana that can do this ?
Thanks a lot in advance !
Hmm, that's interesting! I suppose that if you don't have too many emails this makes some sense (otherwise it might make your Asana Inbox pretty noisy - everyone would see in their inbox every conversation)
I think what I would do is to set up a Gmail filter to automatically forward the email to your team. You can do this in Gmail like this: https://support.google.com/mail/answer/6579?hl=en. If you set up a good filter (i.e. sent to a group address) it seems like it would be pretty painless.
One thing to note is that the conversation in Asana will appear to come from whoever is associated with the email that's sending the conversation to Asana, so if you have a single POC with the outside world, it may make sense to only forward from their account. Alternatively, you could set up a special Asana user just for this purpose, and your teammates can follow a convention that "mailbot" (or whatever user it is) is just used to forward mail, and you should look at the content to get who the author was.

How to mark IMAP message as fetched?

I am working on PHP project that should fetch emails from IMAP server, and store them in local database.
Same IMAP server can be used by other email clients, like outbox and so on.
The problem is how to know which messages I already fetched, and which I didn't? I am thinking to use search by datetime, but is it reliable(I would have cronjob, that would access user mail box every minute, and check for emails, but not sure if datetime can cause some issues, for example in case when at almost same time arrive short message and message with big attachment).
I was thinking about system tags, but user can modify them via email client, so I can rely on them, and don't want to modify them and confuse client.
Next I was thinking about custom tags, but not all IMAP servers support them(and our software need to be flexible as much as possible).
Any good idea how I could solve this problem?
Keep track of the currently highest synced UID of the folder you are syncing, and verify that the UIDVALIDITY value of the folder match.
Unique identifiers are assigned in a strictly ascending fashion in the mailbox; as each message is added to the mailbox it is assigned a higher UID than the message(s) which were added previously. Unlike message sequence numbers, unique identifiers are not necessarily contiguous.

Generating a new email address on the fly, but not really!

I have a blogging application. Once a blog-post is created by a user, it will be sent as an email to some of user's friends. I want a functionality where the friends will just reply to the email and the content of the email will go as comments for that particular blog-post.
One way to do this is to do something similar to what http://ohlife.com does. It basically creates a unique ID per user per day, has the reply-to attribute of the email set to post+{unique_id}#ohlife.com and probably parses this field to know which user is the email for, when it gets received. But it really has only 1 email address which is post#ohlife.com. The part after the "+" get's ignored by email servers. This also is applicable to gmail.
What I wanted to know, is whether this property is for particular email servers or is it universal? If it is not universal, is there is email server independent way of implementing this? I would not want this to be based on the email subject, as it's the trivial solution I know of.
it is depending on your mail server and how it is configured.. (although it is quite a standard) - for example in postfix:
recipient_delimiter = +
you could set it to anything you like .. i once configured it to be a dot so i can use it all over the web.. http://www.postfix.org/postconf.5.html#recipient_delimiter
but you could simply make it configurable in your application as well..
Besides using the email subject or address, one other easy way to accomplish this would be to just stick an identifier number at the bottom of the outgoing email's body. It would then come back to you in the quoted part of the response message. This is much less obtrusive than putting stuff in the subject or address, and if you're using HTML messages you can even make the code invisible.

How can I filter then modify emails using IMAP?

I have asked this question in a different post here on SO:
How can a read receipt be suppressed?
I have been doing some research of my own to try and solve this problem and accessing the email account via IMAP seems like it is going to be a good solution. I have successfully been able to access my own inbox and mark messages as read with no issue.
I have been asked to perform the same task on an inbox that contains over 23,000 emails. I would like to run the test on a small amount of emails from that inbox before letting the whole 23,000 get it.
Here is the code I have been running via telnet:
LOGIN user#mailserver.com password
SELECT Inbox
STORE 1:* flags \Seen 'this line marks all the emails as read
So my question is, how can I execute that STORE command on a specific group of emails ... say emails that are going to / coming from a specific account? Is there a way to concatenate the commands like a FETCH then the STORE? Or is there a better way to go about getting a collection of emails based on certain criteria and then modifying ONLY those emails that can be accomplished through IMAP?
Take a look at the IMAP SEARCH command. The syntax is really awful, but it'll let you search for recipients or senders, for certain words in the subject or the body of messages. It will give you a list of message ids and you can use those message ids in your call to STORE.

Newsletter: How is it possible to determine how many people opened the e-mail?

Exact duplicate of Is there a way to determine whether an e-mail reaches its destination?
Hi all,
I heard that it's possible to determine how many people opened a newsletter and analyze WHEN they opened the mail.
I just wanted to know how that's possible... is it necessary to generate a "read confirmation" or is such an analysis possible without letting the recipient know?
Thanks a lot for your input...
See also Is there a way to determine whether an e-mail reaches its destination?, my answer repeated below:
If you make the email HTML based, you
can include images in it which contain
URLs with information unique to the
recipient. You could structure your
application so that these URLs trigger
some code to mark that particular
email as read before returning the
required image data.
To be totally effective, the images
would have to form a key part of the
email, so that the recipient has to
make their email client grab the
images. You could also make the plain
text part of the email just contain a
URL to retrieve the full message,
again allowing you to track receipt.
How far you take these ideas depends on why you need to know it's been read
and to what extent you want to
potentially annoy the recipient with
an email they can't cut'n'paste, read
easily on mobile device, listen to
with a screenreader, etc...
There is no way to guarantee that someone has opened your newsletter e-mail. But you can get a clue of how many time it was opened by embedding a one pixel image in you mail and use the statistics of you web server to determine how often it was requested.

Resources