Making a mail hook to send a post request - email

I want to do something similar to http://www.mailhooks.com/. When a email is received, it sends a post request to a provided website, but I don't know where to start implementing such a thing. Do textual email interface, such as mutt and pine allow receive hook, if not what would be the best way to do this?

An easy way is to use .procmailrc or .forward. Using either one you can pipe any incoming messages to a program of your choice.
E.g. using procmailrc:
:0:
| ~/myprogram
The program should then read the message from stdin and perform the post request.

Related

Sending Message and Attachment with Perl

I have some emails from Mail::POP3Client that I need to send (including attachments) to another email address (essentially, as if it were forwarded from a common email client).
I'm not very familiar with Perl, so I've been looking into this for a while. I'm not sure of the best way to do this; do I need to use RetrieveToFile and then send it with MIME::Lite? Will that be readable by a human and include attachments?
It seems like there has to be a simpler way that I haven't discovered yet. Am I on the right track?
I've done similar things with MIME-tools, which is a similar package. At the time I did that, MIME-Lite didn't exist. But I am sure that MIME-tools can handle what you ask. I can't imagine that MIME-Lite shouldn't be able to do something similar.
Forwarding like a desktop mail client does consists of two parts:
email munging
Use Courriel::Builder to create a new email. Attach the email that you originally received. The appropriate mime_type parameter for the attached email is message/rfc822.
email sending
Use Email::Sender.
You probably want to redirect, not forward the email, though, so that the original sender stays the same and the recipient can easily reply.

How to implement a "reply to this email" feature for my web application?

I have an application that sends emails when a user creates/modifies a record. I would like my users to be able to reply to the email that was sent to them and have the web application receive the email, parse it and update the record automatically. I have seen this done in web apps like Basecamp. The email usually says "Reply above this line", and if you simply reply to the email, you don't have to log in to the web application in order to update your ticket/conversation.
How can I go about implementing this sort of functionaly? (I'm not looking for a particular language implementation, but rather a language agnostic solution).
There are 2 ways you can do this:
You could use a Procmail filter to pipe the incoming email to your script. This would need some 'nix knowhow to setup - but it's certainly possible to do what you described via this method.
Use a service like MailGun - they do all the hard work of setting up and configuring the mail server stuff and expose it to you via a nice programmable web API. I've been evaluating it this week to solve a similar problem like the one you are having and I can tell you: it is really cool and I highly recommend you check it out yourself.
You'll need to implement a service/daemon that polls an email inbox for new messages. To relate an incoming email to the corresponding data, you can include an id in the outgoing email's subject.
I agree you should created a system to receive the incoming email but I don't necessarily agree that polling for it is the correct solution. Take a look at a blog post I wrote on the subject here. It relates to Rails but the concepts should work in any language. That's why we wrote the CloudMailin system to provide a better way of receiving the email.
Also you can use a unique from address for each email that would prevent the user from altering the subject line being a problem. The disposable part of an email address is useful for that. reply+user123#example.com for example.

MFMessageComposer iPhone,Auto Message Send

Any one know how to implement auto send message using MFMessageComposer....i mean No need of displaying The message Composer..we Have to sent the pre-defined message to a given Number..Or any other way without using MFMessageComposer..???
You can't auto-send messages with MFMessageComposer. It always displays the message to the user before sending (and rightly so).
An alternative would be to call a webservice which dispatches an email to you. Or put enough SMTP code in your app to get emails sending. You'll need your own email system for this though as you'll not be able to get the users email settings.

Playing Chess via SMS Messaging

I know there are some pretty nice open-source chess engines with powerful AI, like Crafty, that also have a nifty command line interface.
I also know that I can send e-mails with my SMS-capable phone, and that I can reply to such an e-mail, and it will be sent to my phone as a SMS text message.
Is there any way I can combine the two? For example, text message a command like "Nd3" to an e-mail monitored by a computer, which sends the command to Crafty, and e-mails back the response?
I wasn't sure which site to post this one on; hopefully this is appropriate.
Instead of parsing emails back and forth, you could use one of the SMS gateways out there like Twilio that supports sending and receiving messages via HTTP POST requests. I don't know of any free ones off hand that do it this way, but using regular ol' HTTP could save you a lot of time fussing with email servers and such.
Full disclosure: I work at Twilio.

Fire an event when email is received

I'm trying to write something that puts the contents of the message on a queue, to have work done on it later. I've been messing around with IMAP IDLE with varying degrees of success.
I was wondering if anyone knows of a method to have a mail server receive an email, and then perform an action like posting the contents of the email to a URL endpoint.
Any ideas? Thanks!
Try fetchmail and procmail. You periodically poll the mail server (every minute if necessary) and use fetchmail to download from the IMAP server. Set up a procmail rule to run your notifier application on emails that match your selection criteria.
Any of the scripting languages (perl, python, tcl/tk etc.) have good, mature and easy to use email handler libraries (in fact you can get this sort of thing for most lanaguages), so it should be quite straightforward to write the handler in one of those.
Configure the SMTP (mail transport) server to deliver the mail to an application that performs the desired action. Don't do it on the IMAP (mailbox client) level if you can avoid it.