Command line email tool

So I want to do some automated email processing (someone sends me an email with a particular subject line, and something automatic runs and sends an email back). I’m a professional programmer so I know what I’m doing with code, but I’ve never even remotely touched anything like this. So I’m hoping that there’s a command line email tool, where I could set something up that runs every 5 minutes where I call “getMyGMail.exe -username foo -password -bar”, that talks to GMail (or some other such free mail site) and dowloads all new emails into a directory. Then I can easily write code to scan the directory, process all the email, etc. Then I can run “sendGMail.exe” once for each email I want to send, wait 5 minutes, and repeat.

At least, that’s how I envision it.
Anyone know of an easy way to do this?

thanks!

Most mail programs have much have this ability. If you are on a Mac, for instance, use the mail rules to scan incoming email and then have it call an AppleScript or Automator action that has the information for sending the return email.

Additionally, if you want command line tools Linux/Unix have built in tools for sending mail, but a warning that I know people who have had trouble getting it through the internet in these days of authentication, etc.

For just sending email from the command line, I like Blat (http://www.blat.net/) but Blat doesn’t know how to check email so it’s only half of what you need.

This is presumably on a PC, as that’s all I have immediate access to.

http://www.chilkatsoft.com/

‘Mail Command’ (last one in first column) is a command line one.
Lots of other email stuff there if you are looking to build your own app.

There is also a sendmail for windows. I’m not sure if it’s a port of the unix sendmail or completely different. I use sendmail on linux to send through gmail, so you shouldn’t have any problems authenticating gmail with a good client.

If a simple scan for keywords will suffice and you don’t need programmatic logic, Gmail itself can do this using the “filters” and “canned responses” features.

You said PC, but you didn’t specify what OS. If you’re willing to go the Linux route, fetchmail and procmail are the tools you’re looking for.

Now that’s a tool I hadn’t thought of in ages. It will definitely do what the OP wants, provided he has the perseverance to beat it into submission first.

If I were doing this, I’d throw together a small script that takes advantage of IMAP’s IDLE command. Gmail supposedly supports it, and it would allow you to watch for new messages without having to actively poll their servers for new messages.

If you’re familiar with Perl, then you can let Mail::IMAPClient do most of the dirty work for you.

PHP has a lot of email handling tools in the standard installation, and it runs on Unix, Linux, Mac, and Windows. The string handling (for doing the filtering) isn’t as good as Perl, but it’s still pretty powerful and easy to use.

I’ve finally figured this out, and it’s (to me) fairly hilariously complex.

For getting the emails, I’ve installed cygwin, and am using fetchmail, which itself uses procmail. This gets all the emails into a mailbox file, which I can then open up with my C code and clumsily parse.

For sending the emails, I’m basically using the instructions found here, which involve two entirely different programs, namely stunnel and blat.

If it works, and your solution uses tools you’re comfortable with, then hoorah! Don’t worry about whether you (or others) find it hilariously complex.

Long ago in a galaxy far far away, Unix had a “filter” command. In the old email setup, you had vacation mode. In vacation mode, you could put text what you wanted to say when someone mailed you, or you could put a pipe to a program.

The “filter” command allowed you to easily parse email messages for sender, subject, etc. You setup your vacation program to use the filter command, and then setup a configuration file for the filter command to use. I wonder if it’s still there.

This was back in the days when people argued whether you used mailx or Elm as your mail client. Real programmers wouldn’t be caught using Elm because it had a menu. Real men knew how to type in the arcane one and two letter mailx commands and knew how to customize their .mailrc file. And, I’m not even going to say anything about the people who used Pine.

Yes sir, those were the days when men were men, and women were… completely uninterested in us…

I use the VBscript at марафонбет беларусь - Регистрация БК Marathon . I had been using blat for command-line emailing in Windows, but it doesn’t seem to support SSL, required by Gmail.

MaxTheVool, out of curiosity, did you ever look into Gmail’s canned responses and filters? Did they lack the functionality you needed?