LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-24-2012, 12:07 PM   #1
Eppo
Member
 
Registered: Feb 2007
Location: NY
Distribution: Arch, Ubuntu
Posts: 77

Rep: Reputation: 27
how to process users email


So what i'm trying to do is process mail delivered to a certain user using a perl script.
I read that i shouldnt try to work with /var/mail/username, because if mail is delivered when the script is running i may lose mail.
I'm running postfix, is there an easy way to say if mail comes in for user test1 to send it as an argument to the script? or even deliver a text copy to another file that i can work on?
I'm reading about Postfix content filtering, but so far it looks like it does it for all users, which i dont want.
Thanks
Joe
 
Old 04-24-2012, 12:23 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,646

Rep: Reputation: 7969Reputation: 7969Reputation: 7969Reputation: 7969Reputation: 7969Reputation: 7969Reputation: 7969Reputation: 7969Reputation: 7969Reputation: 7969Reputation: 7969
Quote:
Originally Posted by Eppo View Post
So what i'm trying to do is process mail delivered to a certain user using a perl script.
I read that i shouldnt try to work with /var/mail/username, because if mail is delivered when the script is running i may lose mail.
I'm running postfix, is there an easy way to say if mail comes in for user test1 to send it as an argument to the script? or even deliver a text copy to another file that i can work on?
I'm reading about Postfix content filtering, but so far it looks like it does it for all users, which i dont want.
Thanks
Joe
Sure. There are several Perl modules that can interface with both POP and IMAP email servers:
http://search.cpan.org/~conteb/IMAP-...IMAP/Client.pm
http://search.cpan.org/~markov/Mail-...l/Box/POP3.pod

I did the same thing in the past using the IMAP module...had it read a list of user ID's, and perform a check to see if new mail had come in, and do something if it did. You can set it to leave the mail marked as unread/unchecked, or flag it as checked/read. Handy, because you won't process the same message(s) more than once, and still be able to leave them in the mailbox for later use, if you want.
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
email notification on backup process! yashvanth Red Hat 6 03-26-2012 01:21 AM
running process that sends email when returns 0 volumes Linux - Server 1 07-20-2010 11:13 AM
Process email on the pop3 server cov Linux - Networking 4 05-10-2007 10:44 AM
LXer: Process your email with procmail LXer Syndicated Linux News 0 04-14-2006 08:03 AM
Skip a step in the Email process langman Linux - Networking 6 02-25-2004 07:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration