Project

General

Profile

Accept mail from unknown user?

Added by Andrey Tatarnikov about 12 years ago

I have installed redmine with this HowTo: http://hodza.net/2012/03/15/howto-install-redmine-on-debian-6-squeeze-ruby-on-rails-apache2-passenger/
And added mail support as here described: http://www.redmine.org/projects/redmine/wiki/RedmineReceivingEmails

redmine /var/www/redmine # RAILS_ENV=production script/about
About your application's environment
Ruby version              1.8.7 (i486-linux)
RubyGems version          1.3.7
Rack version              1.1.3
Rails version             2.3.14
Active Record version     2.3.14
Active Resource version   2.3.14
Action Mailer version     2.3.14
Active Support version    2.3.14
Application root          /var/www/redmine
Environment               production
Database adapter          mysql
Database schema version   20110902000000

So, now I want my Redmine to accept mail from unknown e-mails and create issue from it.

/etc/aliases:

redmine ~ # cat /etc/aliases
# See man 5 aliases for format
postmaster:    root
test:   "|/etc/postfix/rdm-mailhandler.rb --url http://domain --key KEY_HERE --project test" 
redmine:   "|/etc/postfix/rdm-mailhandler.rb --url http://domain --key KEY_HERE" 
utest:   "|/etc/postfix/rdm-mailhandler.rb --unknown_user=accept --no-permission-check --url http://domain --key KEY_HERE --project under_test" 

When I'm trying to send mail to utest@domain I have following lines at mail.log:

Aug 22 14:03:58 redmine postfix/smtpd[7198]: connect from mail-lb0-f176.google.com[209.85.217.176]
Aug 22 14:03:58 redmine postfix/smtpd[7198]: 19A9B3DA21F7: client=mail-lb0-f176.google.com[209.85.217.176]
Aug 22 14:03:58 redmine postfix/cleanup[7202]: 19A9B3DA21F7: message-id=<5034E6C3.10409@domain>
Aug 22 14:03:58 redmine postfix/qmgr[5242]: 19A9B3DA21F7: from=<unknown@domain>, size=2131, nrcpt=1 (queue active)
Aug 22 14:03:58 redmine postfix/local[7203]: 19A9B3DA21F7: to=<utest@domain>, relay=local, delay=0.24, delays=0.09/0.01/0/0.15, dsn=5.3.0, status=bounced (Command died with status 1: "/etc/postfix/rdm-mailhandler.rb --unknown_user=accept --no-permission-check --url http://domain --key KEY_HERE --project under_test". Command output: /etc/postfix/rdm-mailhandler.rb: unrecognized option `--unknown_user=accept' /usr/lib/ruby/1.8/getoptlong.rb:403:in `set_error': unrecognized option `--unknown_user=accept' (GetoptLong::InvalidOption)  from /usr/lib/ruby/1.8/getoptlong.rb:510:in `get_option'  from /usr/lib/ruby/1.8/getoptlong.rb:611:in `each'  from /usr/lib/ruby/1.8/getoptlong.rb:610:in `loop'  from /usr/lib/ruby/1.8/getoptlong.rb:610:in `each'  from /etc/postfix/rdm-mailhandler.rb:106:in `initialize'  from /etc/postfix/rdm-mailhandler.rb:186:in `new'  from /etc/postfix/rdm-mailhandler.rb:186 )
Aug 22 14:03:58 redmine postfix/cleanup[7202]: 4CD4B3DA314C: message-id=<20120822140358.4CD4B3DA314C@domain>
Aug 22 14:03:58 redmine postfix/qmgr[5242]: 4CD4B3DA314C: from=<>, size=5442, nrcpt=1 (queue active)
Aug 22 14:03:58 redmine postfix/bounce[7205]: 19A9B3DA21F7: sender non-delivery notification: 4CD4B3DA314C
Aug 22 14:03:58 redmine postfix/qmgr[5242]: 19A9B3DA21F7: removed

What am I doing wrong?


Replies (1)

RE: Accept mail from unknown user? - Added by Andrey Tatarnikov about 12 years ago

Changed unknown_user to unknown-user. Now I have this in mail.log:

Aug 22 14:44:52 redmine postfix/smtpd[11810]: connect from mail-lb0-f176.google.com[209.85.217.176]
Aug 22 14:44:52 redmine postfix/smtpd[11810]: D11C33DA316C: client=mail-lb0-f176.google.com[209.85.217.176]
Aug 22 14:44:52 redmine postfix/cleanup[11814]: D11C33DA316C: message-id=<5034F058.6050908@domain>
Aug 22 14:44:52 redmine postfix/qmgr[5242]: D11C33DA316C: from=<unknown@domain>, size=2139, nrcpt=1 (queue active)
Aug 22 14:44:53 redmine postfix/local[11815]: D11C33DA316C: to=<utest@domain>, relay=local, delay=0.5, delays=0.15/0/0/0.34, dsn=5.7.0, status=bounced (permission denied. Command output: Request was denied by your Redmine server. Possible reasons: email is sent from an invalid email address or is missing some information. )
Aug 22 14:44:53 redmine postfix/cleanup[11814]: 53AC63DA3173: message-id=<20120822144453.53AC63DA3173@domain>
Aug 22 14:44:53 redmine postfix/qmgr[5242]: 53AC63DA3173: from=<>, size=4336, nrcpt=1 (queue active)
Aug 22 14:44:53 redmine postfix/bounce[11822]: D11C33DA316C: sender non-delivery notification: 53AC63DA3173
Aug 22 14:44:53 redmine postfix/qmgr[5242]: D11C33DA316C: removed

And this in production.log:

Processing MailHandlerController#index (for 149.154.65.66 at 2012-08-22 18:44:53) [POST]
  Parameters: {"no_permission_check"=>"1", "unknown_user"=>"accept", "allow_override"=>"", "issue"=>{"project"=>"under_test1"}, "key"=>"KEY_HERE", "email"=>"From unknown@domain  Wed Aug 22 18:44:52 2012\nReturn-Path: <unknown@domain>\nX-Original-To: utest@domain\nDelivered-To: utest@domain\nReceived: from mail-lb0-f176.google.com (mail-lb0-f176.google.com [209.85.217.176])\n\tby domain (Postfix) with ESMTP id D11C33DA316C\n\tfor <utest@domain>; Wed, 22 Aug 2012 18:44:52 +0400 (MSK)\nReceived: by lboi15 with SMTP id i15so595960lbo.7\n        for <utest@domain>; Wed, 22 Aug 2012 07:44:52 -0700 (PDT)\nX-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=google.com; s=20120113;\n        h=message-id:date:from:user-agent:mime-version:to:subject\n         :content-type:content-transfer-encoding:x-gm-message-state;\n        bh=cA3AHxHGljQc0saLQ0S0M2+grC26zBHH30PJyGCGt9A=;\n        b=H+vAZheYvo4JF3ND2Dsqz/P/KPSIo93HMwdOLe9bnbW19P8u9m2WKmpkGYQemQYxsk\n         i9HoAXns40P8Q/e9a0vXR+Hei6nXJFIyOiHxDku6buUuhztrg/yqMVSzaWXJee/21/TI\n         5ejM9ZyyCHa042VDnckXqLpfXgF2vBB4iB/9FfGcYWCy42Z0FNOVzUkU+yFMpUy/AYnA\n         I1ZFbnYziqslu1AnQh9XyinpkimnT2ArvlawaBTwF6T+1+GPkUrQewF8bNAq8zj9XQNh\n         5La8+OTruRHwz/LYrxUHr+QBCJpGSD1kZ/Rh1QTb3zFvZU96rPedFW+6sYWLNfMJxbLo\n         dcLw==\nReceived: by 10.152.148.199 with SMTP id tu7mr21368856lab.37.1345646692603;\n        Wed, 22 Aug 2012 07:44:52 -0700 (PDT)\nReceived: from [127.0.0.1] ([77.50.99.130])\n        by mx.google.com with ESMTPS id ba4sm1192723lbb.14.2012.08.22.07.44.44\n        (version=SSLv3 cipher=OTHER);\n        Wed, 22 Aug 2012 07:44:44 -0700 (PDT)\nMessage-ID: <5034F058.6050908@domain>\nDate: Wed, 22 Aug 2012 18:44:40 +0400\nFrom: Andrey Tatarnikov <unknown@domain>\nUser-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20120713 Thunderbird/14.0\nMIME-Version: 1.0\nTo: utest@domain\nSubject: test\nContent-Type: text/plain; charset=UTF-8; format=flowed\nContent-Transfer-Encoding: 8bit\nX-Gm-Message-State: ALoCoQmskXi5zDssmCWpzFaJYUGH9L7IvK5DZFPHXBKqlWrOobJddclMxhpkO9xtMh6A0yQIZ37D\n\ntest\n\n-- \nп¦ я¬п¦п¦пІп¦пҐпTп¦п+,\nп-п¦я-п¦я-пҐпTп¦п+п¦ п-пҐпЄя-п¦п¦ п¦п+пTя-я-пTп¦п¦пTя+\nя-п¦я-пҐпTя+п¦я¦п¦пTп¦ я-п¦я¦п©п¦я-я- п?п-п· \"п=п¦я¦я¬я-я¦п¦п¦я-п¦пTя¦\"\nп=п¦п¦. я-п¦п¦.:    +7 (495) 797 40 61 пЄп+п¦. 857\nпєп¦п¦я¦:          +7 (495) 961 20 58\n\n"}
Completed in 163ms (View: 0, DB: 148) | 422 Unprocessable Entity [http://domain/mail_handler]

    (1-1/1)