Results 1 to 10 of 10

Thread: Zimbra and Procmail

  1. #1
    andreychek is offline Special Member & Volunteer
    Join Date
    Oct 2005
    Location
    Harrisburg, Pennsylvania
    Posts
    155
    Rep Power
    9

    Default Zimbra and Procmail

    Howdy,

    In one of the environments I plan to run Zimbra, it will be for a set of
    mostly email-only users, mixed in with a handful of administrators and power
    users who have accounts on the machine.

    Zimbra is perfect for the email-only users. It's also perfect for these admins
    and power users. Well, almost.

    The folks with accounts on the machine are used to using things like procmail
    and mutt for managing email. Now, one can certainly continue to use both mutt
    and Zimbra via IMAP. It's procmail that I'm curious about.

    Do you have any thoughts as to how one might integrate procmail and Zimbra
    together, expecially when the desire is to only use a single piece of hardware
    to do so?

    Being able to use procmail to specify what folder to store data in Zimbra would
    be kind of neat, though Zimbra does provide that sort of functionality as a filter already.

    However, another use of procmail is to automate tasks based on emails that
    arrive. If someone receives an email to a particular address with a particular
    subject, run some command on the system.

    One way I can think of to do this would be to run a non-Zimbra mail daemon on
    port 25, that delivers to a user if one exists /etc/passwd, or to Zimbra
    otherwise. The biggest problem here is that there are now two mail daemons,
    and two sets of email accounts (those with system accounts and those with
    Zimbra accounts).

    Do you see a better way of handling this? For starters, could Zimbra perhaps
    offer the ability to run a system command based on certain criteria within an
    email? That of course would need to be something the system admin could enable
    or disable, not all admins would want users executing commands.

    Beyond that though, do you see a way to provide the full power of procmail
    within Zimbra for those who get lonely without their command line? :-)
    -Eric

  2. #2
    anand is offline Zimbra Employee
    Join Date
    Sep 2005
    Posts
    274
    Rep Power
    9

    Default

    eric, can you give us some specific examples of procmail things that your users are doing today, other than sieve filtering for classifiying mail into folders (which Zimbra already supports). One example you cited was autoresponders, are there others? What sort of messages do users autorespond to, other than vacation? I am wondering if there is some system wide mechanism or feature here that will take care of most of the requirements, instead of having all the Runtime.exec and arbitrary command running security issues.

  3. #3
    andreychek is offline Special Member & Volunteer
    Join Date
    Oct 2005
    Location
    Harrisburg, Pennsylvania
    Posts
    155
    Rep Power
    9

    Default

    Quote Originally Posted by anand
    eric, can you give us some specific examples of procmail things that your users are doing today, other than sieve filtering for classifiying mail into folders (which Zimbra already supports). One example you cited was autoresponders, are there others? What sort of messages do users autorespond to, other than vacation? I am wondering if there is some system wide mechanism or feature here that will take care of most of the requirements, instead of having all the Runtime.exec and arbitrary command running security issues.
    Well, it wasn't autoresponders that we're using... it was moreso automation of tasks based on criteria within an email.

    A few examples of what we're doing:

    * Based on the To: and Subject: headers, forward an email to another address. Optionally reformat or add some headers (this can be used to forward a message to a cell phone).

    * Based on the To: header, execute a Perl script which parses the attachments, and submits them to Hylafax as outgoing faxes.

    * Based on the To: and Subject: headers, execute a Perl script which parses the body of the email message, and sends the information to a database.

    * One of the guys even has it setup so that the body of any emails coming from his cell phone are automatically added to his blog, which includes handling of images sent along with them.

    I guess the issue is that without procmail, a lot of flexibility is lost... I'm not sure how you could handle the above without allowing arbitrary execution of commands, letting UNIX/Linux permissions handling the security. It's then the admin's job to keep the system up to date :-)

    I feel that there are some administrators who look forward to users being able to execute commands like this, especially in an environment where you can fire someone for being malicious :-) However, even with web hosting, it's fairly typical to offer users procmail support. It'd be kind of a bummer if users turned down hosts running Zimbra simply because they knew there wasn't a way to run procmail.

    Of course, the opposite is true as well. Some admins wouldn't want that at all. So the ability for the admin to disable it, perhaps even per-user, would be important.

    While it'd be neat if Zimbra could handle all this, perhaps there's a way around that. A second choice for handling this would be running two MTA's (Zimbra and say, Postfix) on the machine, but only if the two could cooperate.

    To allow cooperation, what if there were a command-line tool for delivering an email to Zimbra?

    Here's the hypothetical scenerio --

    We have two MTA's on a server... Postfix on port 25, and Zimbra on some higher port. An email comes in. If Postfix finds no local user to deliver it to, it hands off to Zimbra to finish the job. If it does find a local user (meaning that user has a system account), it delivers to that user, using procmail if that's how the sysadmin set things up.

    Now, here's where that cooperation needs to take place... we don't want to deal with two differnent mail spools. So, after procmail processes the message, if the user wants to store it, maybe they could pipe it into a command line tool that understood how to feed an email into Zimbra. It'd be
    particularly useful if one of the arguments that tool accepted were the folder in which to store the email.

    Does such a tool exist already? And if not, does this sound like something that'd be useful? With this, Zimbra wouldn't actually have to support procmail, but for those who insist, we could just write up instructions on how to run two MTA's :-)

    If there's any additional information I can provide, please feel free to ask.

    Thanks,
    -Eric

  4. #4
    KevinH's Avatar
    KevinH is offline Expert Member
    Join Date
    Aug 2005
    Location
    San Mateo, CA
    Posts
    4,789
    Rep Power
    18

    Default

    Quote Originally Posted by andreychek
    Now, here's where that cooperation needs to take place... we don't want to deal with two differnent mail spools. So, after procmail processes the message, if the user wants to store it, maybe they could pipe it into a command line tool that understood how to feed an email into Zimbra. It'd be
    particularly useful if one of the arguments that tool accepted were the folder in which to store the email.

    Does such a tool exist already? And if not, does this sound like something that'd be useful? With this, Zimbra wouldn't actually have to support procmail, but for those who insist, we could just write up instructions on how to run two MTA's :-)
    zmlmtpinject


    Might not have the folder option but should allow you to inject mail. Of course you can always use the SOAP API for full control.

  5. #5
    mikeygstl is offline Member
    Join Date
    Nov 2005
    Posts
    13
    Rep Power
    9

    Default procmail utilization at our company...

    We are toying with the idea of using zimbra for our mail, but also have a small quandry.

    Currently, our users can send email to their pagers/voicemail by simply sending to their ##########@ourdomain.com. procmail simply strips these messages and passes it on to a piece of software running on our switch via a serial link.

    Would there currently be a way to set up a mail filter to forward these types of messages post spam/virii filtering? Perhaps this sets up room for another 3rd party plugin in the email chain?

    I'm not scared to go ahead and start mucking around if someone out there could point me in the right direction. It appears that this could be useful to many. I just don't want to play in config files that must be altered via the gui...

    My initial thoughts were to have postfix reroute mail matching addresses consisting of nine-digit recipients. Any suggestions?

  6. #6
    marcmac is offline Expert Member
    Join Date
    Sep 2005
    Posts
    2,103
    Rep Power
    13

    Default forwards

    One possibility, with little config change:

    create account pager@domain.com
    add an alias to that account for every phone number needed.
    Set up a fetchmail cronjob that grabbed the mail from that account, parsed out the phone number, and handed it to whatever software you're using now.

  7. #7
    andreychek is offline Special Member & Volunteer
    Join Date
    Oct 2005
    Location
    Harrisburg, Pennsylvania
    Posts
    155
    Rep Power
    9

    Default

    Quote Originally Posted by marcmac
    One possibility, with little config change:

    create account pager@domain.com
    add an alias to that account for every phone number needed.
    Set up a fetchmail cronjob that grabbed the mail from that account, parsed out the phone number, and handed it to whatever software you're using now.
    This is a great idea that may work for my problem too, where users on the system with shell accounts want to do fun things with procmail.

    So, instead of trying to deal with two MTA's as I described above (Postfix on port 25, Zimbra on some other port), one could run only Zimbra. Users with shell accounts could setup fetchmail on the server running Zimbra. Fetchmail could poll any Zimbra account, or any folder within an account.

    With that, we could setup Zimbra to look for messages that need to be handled by procmail (based on some criteria like a header, or certain text in the subject), and then put it into a special folder, such as one called 'procmail'.

    We then setup fetchmail to poll the Zimbra server using IMAP, only download email from the folder 'procmail', and tell fetchmail not to attempt normal mail delivery as it usually would, but use 'mda' keyword to deliver it directly to procmail.

    This can all be done from the Zimbra server itself, which is perfect for our users.

    marcmac, that's a great idea, and will probably save a lot of time and setup headaches :-)

    Thanks,
    -Eric

  8. #8
    oleg is offline New Member
    Join Date
    Dec 2006
    Posts
    4
    Rep Power
    8

    Default how to invoke procmail

    Hi,

    I would like to call procmail script to forward some users' emails to an alternative address. We used to do it when our company used sendmail. Now we switched to Zimbra and I would like to find out how do I tell zimbra/postfix to envoke procmail.

    thanks

  9. #9
    phoenix is online now Zimbra Consultant & Moderator
    Join Date
    Sep 2005
    Location
    Vannes, France
    Posts
    23,569
    Rep Power
    57

    Default

    Quote Originally Posted by oleg View Post
    Hi,

    I would like to call procmail script to forward some users' emails to an alternative address. We used to do it when our company used sendmail. Now we switched to Zimbra and I would like to find out how do I tell zimbra/postfix to envoke procmail.
    You can use the functions in Zimbra to forward email to another address, have you looked at the options in a user mailboxes and the admin ui?
    Regards


    Bill


    Acompli: A new adventure for Co-Founder KevinH.

  10. #10
    oleg is offline New Member
    Join Date
    Dec 2006
    Posts
    4
    Rep Power
    8

    Default

    Quote Originally Posted by phoenix View Post
    You can use the functions in Zimbra to forward email to another address, have you looked at the options in a user mailboxes and the admin ui?
    Yes, I know that. But I need to do more - I need to strip the attachments, before forwarding to another address. Does someone has an answer to my original question - how do I call procmail.
    Zimbra is a great product. But if it's designers impose restrictions on users it will be just like another microsoft product. They can not possibly implement every imaginable feature on the interface. That's what unix tools, such as postfix are for.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Zimbra Outlook Profile - can't change "From" address
    By justanotheruser in forum Migration
    Replies: 2
    Last Post: 02-25-2011, 01:13 PM
  2. checking mail delivery subject procmail (ish)?
    By bowergo in forum Administrators
    Replies: 0
    Last Post: 03-21-2007, 06:22 AM
  3. Mail filters versus procmail
    By jbwiv in forum Users
    Replies: 1
    Last Post: 02-23-2007, 01:02 PM
  4. zimbra & procmail
    By alessio in forum Administrators
    Replies: 0
    Last Post: 01-26-2007, 10:08 AM
  5. Procmail to Zimbra
    By Finn in forum Installation
    Replies: 3
    Last Post: 09-29-2005, 02:48 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •