Results 1 to 4 of 4

Thread: Forwarding email to ruby script

  1. #1
    Join Date
    Jun 2012
    Location
    Croatia
    Posts
    3
    Rep Power
    3

    Default Forwarding email to ruby script

    Hi all,

    We are using redmine for project management and ticketing system. One of the features it provides is possibility to create or answer to a ticket by email (as shown here).

    I managed to configure zimbra to forward emails from local users, by:
    1. Adding following to /opt/zimbra/postfix/conf/master.cf.in
      Code:
       ruby      unix  -       n       n       -       -       pipe
          flags=DRhu user=zimbra argv=/usr/local/bin/rdm-mailhandler.rb
          --url https://support.company.com/redmine
          --key deojfjewopfkoewJ --project test
    2. Creating file /etc/zimbra/mytransport with following content
      Code:
      redmine@company.com    ruby:
    3. Settting property postfix_transport_maps
      Code:
      [zimbra@zimbra ~]$ zmlocalconfig postfix_transport_maps
      postfix_transport_maps = hash:/etc/zimbra/mytransport,proxy:ldap:/opt/zimbra/conf/ldap-transport.cf


    When I send email from zimbra itself everything works fine. However when somebody outside my domain (actually I believe it has to be outside of MTA Trusted Networks IP's) tries to send email to redmine@company.com, it fails with an error
    Code:
    550 5.1.1 <redmine@company.com>: Recipient address rejected: User unknown in virtual mailbox table
    Do you have any suggestion how to change this to allow everybody to send mail my redmine system?

  2. #2
    Join Date
    Jun 2012
    Posts
    5
    Rep Power
    3

    Default

    Greetings mmrvelj,

    Just did a search in the forums and I found your message. I can offer a bit of advice, and hope that you can perhaps help me in the return!

    I was having a similar problem, and I found creating a distribution list without adding any people to it solves the issue and lets it run the script.

    My problem however is, I can't get it to send the contents of the message to the script.

    For example, I created a simply bash script:

    Code:
    #!/bin/bash
    
    args=$@
    echo ${args[0]} > /opt/zimbra/scripts/message.txt
    If in /opt/zimbra/postfix/conf/master.cf.in I add ${sender} to the end of the args section it saves the sender. I thought maybe ${body} or ${message} might do the trick, but no such luck. This is where I'm hoping you can help!

  3. #3
    Join Date
    Jun 2012
    Location
    Croatia
    Posts
    3
    Rep Power
    3

    Default

    hi xero9,

    I am not an expert, I mostly followed the guidelines. However, I think that the whole message is passed as standard input to your script, so I would try to experiment in that direction.

    Btw, I tried your suggestion, and created empty distribution list, but no luck. If I put somebody on the list, then this person gets the message, if the list is empty, the message is returned to sender with "Recipient address rejected: User unknown in virtual mailbox" error.

    Did you setup anything else special in your case to make it work? Are you testing with internal or external mail users?

  4. #4
    Join Date
    Jun 2012
    Posts
    5
    Rep Power
    3

    Default

    Good day mmrvelj,

    No worries, I'm far from an expert myself

    There is only one extra command that I ran that you didn't list here.

    I ran 'postmap /opt/zimbra/postfix/conf/transport', or in your case the location is /etc/zimbra/mytransport.

    I've only played around with two Zimbra installs. One here that we're thinking deploying at work, and one at home to play with over the weekend. In both cases, the install was put in /opt/zimbra, but yours may be different? I'm wondering if the location of your transport file has anything to do with it. Maybe it's no readable by the zimbra user.

    Let me know if running that command sucks the contents of that file in and lets it actually work.

    Oh one other tip, I don't know if it matters or not, but in the transport file, I found the addresses needed to be at the top of the file. I don't know if I was missing something at the time and that's why it made a difference, but try making sure it's at the top.

    Afterwards, I ran a 'zmmtactl stop ; zmmtactl start' and the changes should take effect.

    Sorry if this post is very scattered

Similar Threads

  1. Forwarding email to a program
    By Ron Gage in forum Administrators
    Replies: 4
    Last Post: 11-26-2011, 06:23 AM
  2. Email forwarding not working - at all
    By i2ambler in forum Administrators
    Replies: 5
    Last Post: 12-18-2010, 08:52 AM
  3. email to script
    By dhull in forum Administrators
    Replies: 0
    Last Post: 06-23-2009, 11:22 AM
  4. Email Forwarding (Script)
    By Amin Kardan in forum Administrators
    Replies: 3
    Last Post: 10-10-2008, 11:30 AM
  5. Forwarding Email
    By Collins Denny in forum Users
    Replies: 2
    Last Post: 04-19-2007, 04:59 AM

Tags for this Thread

Posting Permissions

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