From: "Zhou, Yan" on
Hi there,



We are intergrating Postfix with a J2EE backend, where all user accounts
and configuration are in J2EE layer with database. Because of this
architecture, we do not want to having to maintain individual user mail
directory, or user account. In other words, if we add a new email
address or new user, nothing changes on Postfix server. To that end, I
wish to let Postfix delegate all email processing to my Java program
that talks to the J2EE backend. We want to process all mails ourselves.



I have tried content filter and transport relay, but run into the same
problem. Since postfix does not know it is a valid email address, it
rejects the emails before my Java program gets it. Reading from the log,
it is the SMTPD that rejects it, so it is before Queue Mgr.



Here is the error. Does not look like relay is taking place, it is still
going through local delivery agent. Any suggestions as to what went
wrong?



Jul 31 13:34:53 mustang postfix/smtpd[18630]: NOQUEUE: reject: RCPT from
unknown[172.18.138.12]: 550 5.1.1 <address(a)mydomain>: Recipient address
rejected: User unknown in local recipient table;



The following are my configuration.



In main.cf:

relay_domains = <my domain, this is the local domain>

transport_maps = hash:/etc/postfix/transport





In /etc/postfix/transport

<my domain> connector



In master.cf

connector unix - n n - - pipe

flags= user=myuser argv=/usr/local/bin/runprocessor -f ${sender} --
${recipient}





where runprocessor is a script that calls Java program.



Thanks,

Yan











Confidentiality Notice: The information contained in this electronic transmission is confidential and may be legally privileged. It is intended only for the addressee(s) named above. If you are not an intended recipient, be aware that any disclosure, copying, distribution or use of the information contained in this transmission is prohibited and may be unlawful. If you have received this transmission in error, please notify us by telephone (513) 229-5500 or by email (postmaster(a)MedPlus.com). After replying, please erase it from your computer system.



From: "Zhou, Yan" on
The error is gone after I set local_recipient_maps
<http://www.postfix.org/postconf.5.html#local_recipient_maps> =


But relay is not happening, it still goes to local delivery agent.
Cannot find why ...



Jul 31 13:52:07 mustang postfix/local[18709]: 512DC150238:
to=<address(a)mydomain >, relay=local, delay=0.16,
delays=0.14/0.01/0/0.01, dsn=5.1.1, status=bounced (unknown user:
"<user>")



From: owner-postfix-users(a)postfix.org
[mailto:owner-postfix-users(a)postfix.org] On Behalf Of Zhou, Yan
Sent: Saturday, July 31, 2010 9:45 AM
To: postfix-users(a)postfix.org
Subject: routing all mails to customized processor, without individual
mail directory



Hi there,



We are intergrating Postfix with a J2EE backend, where all user accounts
and configuration are in J2EE layer with database. Because of this
architecture, we do not want to having to maintain individual user mail
directory, or user account. In other words, if we add a new email
address or new user, nothing changes on Postfix server. To that end, I
wish to let Postfix delegate all email processing to my Java program
that talks to the J2EE backend. We want to process all mails ourselves.



I have tried content filter and transport relay, but run into the same
problem. Since postfix does not know it is a valid email address, it
rejects the emails before my Java program gets it. Reading from the log,
it is the SMTPD that rejects it, so it is before Queue Mgr.



Here is the error. Does not look like relay is taking place, it is still
going through local delivery agent. Any suggestions as to what went
wrong?



Jul 31 13:34:53 mustang postfix/smtpd[18630]: NOQUEUE: reject: RCPT from
unknown[172.18.138.12]: 550 5.1.1 <address(a)mydomain>: Recipient address
rejected: User unknown in local recipient table;



The following are my configuration.



In main.cf:

relay_domains = <my domain, this is the local domain>

transport_maps = hash:/etc/postfix/transport





In /etc/postfix/transport

<my domain> connector



In master.cf

connector unix - n n - - pipe

flags= user=myuser argv=/usr/local/bin/runprocessor -f ${sender} --
${recipient}





where runprocessor is a script that calls Java program.



Thanks,

Yan




Confidentiality Notice: The information contained in this electronic
transmission is confidential and may be legally privileged. It is
intended only for the addressee(s) named above. If you are not an
intended recipient, be aware that any disclosure, copying, distribution
or use of the information contained in this transmission is prohibited
and may be unlawful. If you have received this transmission in error,
please notify us by telephone (513) 229-5500 or by email
(postmaster(a)MedPlus.com). After replying, please erase it from your
computer system.











Confidentiality Notice: The information contained in this electronic transmission is confidential and may be legally privileged. It is intended only for the addressee(s) named above. If you are not an intended recipient, be aware that any disclosure, copying, distribution or use of the information contained in this transmission is prohibited and may be unlawful. If you have received this transmission in error, please notify us by telephone (513) 229-5500 or by email (postmaster(a)MedPlus.com). After replying, please erase it from your computer system.



From: Magnus =?iso-8859-1?Q?B=E4ck?= on
On Saturday, July 31, 2010 at 15:58 CEST,
"Zhou, Yan" <yzhou(a)medplus.com> wrote:

> The error is gone after I set local_recipient_maps
> <http://www.postfix.org/postconf.5.html#local_recipient_maps> =

Don't do that. Postfix must know which recipient addresses are valid.
Luckily Postfix supports a number of lookup mechanisms for determining
which recipients that are valid.

> But relay is not happening, it still goes to local delivery agent.
> Cannot find why ...
>
> Jul 31 13:52:07 mustang postfix/local[18709]: 512DC150238:
> to=<address(a)mydomain >, relay=local, delay=0.16,
> delays=0.14/0.01/0/0.01, dsn=5.1.1, status=bounced (unknown user:
> "<user>")

The transport table lookup is not not working properly. What's the
output of

postmap -q example.com hash:/etc/postfix/transport

where example.com is your domain?

[...]

> In main.cf:
>
> relay_domains = <my domain, this is the local domain>

Yes, but you're obviously also listing the domain in mydestination
(which is why it's routed to local(8)). Pick one address class for
the domains and stick to it.

> transport_maps = hash:/etc/postfix/transport
>
> In /etc/postfix/transport
>
> <my domain> connector

Don't know if the transport name needs to be followed by a colon,
but that's at least what transport(5) suggests. So:

example.com connector:

[...]

--
Magnus B�ck
magnus(a)dsek.lth.se

From: "Zhou, Yan" on
Thanks to all, having "connector:" did fix the problem! I also made a
couple of other configuration changes, but these are minor.
Yan










Confidentiality Notice: The information contained in this electronic transmission is confidential and may be legally privileged. It is intended only for the addressee(s) named above. If you are not an intended recipient, be aware that any disclosure, copying, distribution or use of the information contained in this transmission is prohibited and may be unlawful. If you have received this transmission in error, please notify us by telephone (513) 229-5500 or by email (postmaster(a)MedPlus.com). After replying, please erase it from your computer system.