Reply
 
Thread Tools Display Modes
  #1  
Old 12-13-2010, 12:43 PM
MaxTheVool MaxTheVool is offline
Member
 
Join Date: Aug 2000
Location: Santa Clara, CA
Posts: 11,270
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!
Advertisements  
  #2  
Old 12-13-2010, 01:13 PM
Disheavel Disheavel is offline
Guest
 
Join Date: Nov 2006
Location: Seattle
Posts: 1,306
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.
  #3  
Old 12-13-2010, 01:17 PM
AnalogSignal AnalogSignal is offline
Member
 
Join Date: Feb 2010
Posts: 1,369
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.
  #4  
Old 12-13-2010, 01:18 PM
MaxTheVool MaxTheVool is offline
Member
 
Join Date: Aug 2000
Location: Santa Clara, CA
Posts: 11,270
Quote:
Originally Posted by Disheavel View Post
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.
This is presumably on a PC, as that's all I have immediate access to.
  #5  
Old 12-13-2010, 01:19 PM
LionelHutz405 LionelHutz405 is offline
Guest
 
Join Date: Sep 2003
Location: Burlington, Ontario
Posts: 1,059
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.
  #6  
Old 12-13-2010, 02:56 PM
Fubaya Fubaya is offline
Guest
 
Join Date: Apr 2008
Posts: 3,767
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.
  #7  
Old 12-13-2010, 02:56 PM
Reply Reply is offline
Guest
 
Join Date: Jul 2003
Location: Chicago
Posts: 8,239
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.

Last edited by Reply; 12-13-2010 at 03:00 PM.
  #8  
Old 12-13-2010, 03:20 PM
Kyrie Eleison Kyrie Eleison is offline
Guest
 
Join Date: Mar 2005
Location: Connecticut
Posts: 1,155
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.
  #9  
Old 12-13-2010, 03:43 PM
UncleRojelio UncleRojelio is offline
Guest
 
Join Date: Nov 2004
Location: ATX
Posts: 6,027
Quote:
Originally Posted by Kyrie Eleison View Post
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.

Last edited by UncleRojelio; 12-13-2010 at 03:43 PM.
  #10  
Old 12-13-2010, 07:11 PM
Erasmus Darwin Erasmus Darwin is offline
Guest
 
Join Date: Aug 2001
Posts: 358
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.
  #11  
Old 12-14-2010, 11:18 AM
Gary Robson Gary Robson is offline
Charter Member
Charter Member
 
Join Date: Mar 2003
Location: Montana, U.S.A.
Posts: 9,449
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.
__________________
---
Yes, I have joined the ranks of former moderators. Being a mod was eating my life. Now I'm a member just like you. Except smarter and better looking.
  #12  
Old 12-22-2010, 05:40 PM
MaxTheVool MaxTheVool is offline
Member
 
Join Date: Aug 2000
Location: Santa Clara, CA
Posts: 11,270
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.
  #13  
Old 12-22-2010, 06:51 PM
Gary Robson Gary Robson is offline
Charter Member
Charter Member
 
Join Date: Mar 2003
Location: Montana, U.S.A.
Posts: 9,449
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.
__________________
---
Yes, I have joined the ranks of former moderators. Being a mod was eating my life. Now I'm a member just like you. Except smarter and better looking.
  #14  
Old 12-23-2010, 01:32 AM
qazwart qazwart is offline
Guest
 
Join Date: Aug 2005
Posts: 1,440
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...
  #15  
Old 12-23-2010, 03:34 AM
alaham alaham is offline
Guest
 
Join Date: Dec 2010
Posts: 8
Quote:
Originally Posted by MaxTheVool View Post
sending the emails, I'm basically using the instructions found here, which involve two entirely different programs, namely stunnel and blat.
I use the VBscript at http://cybernetnews.com/vbscript-sen...s-using-gmail/ . I had been using blat for command-line emailing in Windows, but it doesn't seem to support SSL, required by Gmail.
  #16  
Old 12-23-2010, 03:43 AM
Reply Reply is offline
Guest
 
Join Date: Jul 2003
Location: Chicago
Posts: 8,239
MaxTheVool, out of curiosity, did you ever look into Gmail's canned responses and filters? Did they lack the functionality you needed?
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 08:55 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.

Send questions for Cecil Adams to: cecil@chicagoreader.com

Send comments about this website to: webmaster@straightdope.com

Terms of Use / Privacy Policy

Advertise on the Straight Dope!
(Your direct line to thousands of the smartest, hippest people on the planet, plus a few total dipsticks.)

Publishers - interested in subscribing to the Straight Dope?
Write to: sdsubscriptions@chicagoreader.com.

Copyright 2017 Sun-Times Media, LLC.

 
Copyright © 2017