Re: Any C api to access Postfix programmatically?

2009-08-25 Thread Phill Macey
2009/8/24 Δημήτριος Καραπιπέρης dim...@thessaloniki.gr:

 I came to this solution, a bash script to validate a local recipient
 employing the SMTP protocol.

Depending on your config, wouldnt you also be able to use 'postmap -q'
or  'postalias -q' to directly query a particular lookup table? That
would avoid a network connection and avoid cluttering logs with your
half completed connections. I suppose talking SMTP lets you take
advantage of some of the smarts that postfix uses to do more recursive
type lookups or any other validations that might happen in the
background.

(recursive as in, in an access table, attempt to match
u...@host.example.com, then try host.example.com and .example.com etc.
Apologies if I have misunderstood how the access tables do their
matching - Im a noob)

-- 
Phill


Re: Any C api to access Postfix programmatically?

2009-08-25 Thread Δημήτριος Καραπιπέρης


Users source could be ldap or mysql, not a hash file.
In essence, I need to employ the local_recipient_map property, which 
holds all the valid recipients

of the particular Postfix instance.

Dimitrios

O/H Phill Macey έγραψε:

2009/8/ l24 Δημήτριος Καραπιπέρης dim...@thessaloniki.gr:
  

I came to this solution, a bash script to validate a local recipient
employing the SMTP protocol.



Depending on your config, wouldnt you also be able to use 'postmap -q'
or  'postalias -q' to directly query a particular lookup table? That
would avoid a network connection and avoid cluttering logs with your
half completed connections. I suppose talking SMTP lets you take
advantage of some of the smarts that postfix uses to do more recursive
type lookups or any other validations that might happen in the
background.

(recursive as in, in an access table, attempt to match
u...@host.example.com, then try host.example.com and .example.com etc.
Apologies if I have misunderstood how the access tables do their
matching - Im a noob)

  




Re: Any C api to access Postfix programmatically?

2009-08-25 Thread Barney Desmond
2009/8/26 Δημήτριος Καραπιπέρης dim...@thessaloniki.gr:

 Users source could be ldap or mysql, not a hash file.
 In essence, I need to employ the local_recipient_map property, which holds
 all the valid recipients
 of the particular Postfix instance.

You can use postmap -q to make such queries, ldap or mysql works just
the same as querying a hash file. That aside, this has the potential
to be complex anyway, so using SMTP after all isn't unreasonable.


Re: Any C api to access Postfix programmatically?

2009-08-24 Thread Δημήτριος Καραπιπέρης


I came to this solution, a bash script to validate a local recipient 
employing the SMTP protocol.



#!/bin/bash

nc localhost 25  EOF | grep '250 2.1.5 Ok' | sed 's/250 2.1.5 Ok/OK/'
 HELO localhost
 MAIL FROM: dim...@thessaloniki.gr
 RCPT TO: $1
 QUIT
EOF

Dimitrios



O/H Wietse Venema έγραψε:

? ???:
  

Hi !

Is there any Programming Interface (api) , so that a Postfix instance
could be accessed programmaticaly, say, a C program?



Currently,  all the SUPPORTED interfaces require that non-Postfix
code communicates with Postfix via some protocol:  examples are
the SMTP protocol, the pipe-to-command protocol, the SMTPD policy
protocol, the Milter protocol, and a simple TCP-based lookup table.

  

for example, connect to a Postfix instance and validate if an e-mail
address is a valid recipient  for the specific instance...



You can already do this with the existing SMTP interface.

Wietse
  


Any C api to access Postfix programmatically?

2009-08-22 Thread Δημήτριος Καραπιπέ ρης
Hi !

Is there any Programming Interface (api) , so that a Postfix instance
could be accessed programmaticaly, say, a C program?

for example, connect to a Postfix instance and validate if an e-mail
address is a valid recipient  for the specific instance...

thanks
Dimitrios Karapiperis



Re: Any C api to access Postfix programmatically?

2009-08-22 Thread /dev/rob0
On Saturday 22 August 2009 15:12:45 Δημήτριος Καραπιπέρης wrote:
 Is there any Programming Interface (api) , so that a Postfix
 instance could be accessed programmaticaly, say, a C program?

Maybe just speak SMTP to it? I'm sure there are SMTP libraries
already written and available.

 for example, connect to a Postfix instance and validate if an
 e-mail address is a valid recipient  for the specific instance...

I think for this, you would do better to simply consult whatever
backend the Postfix instance is using for recipient validation.
-- 
Offlist mail to this address is discarded unless
/dev/rob0 or not-spam is in Subject: header


Re: Any C api to access Postfix programmatically?

2009-08-22 Thread Wietse Venema
? ???:
 Hi !
 
 Is there any Programming Interface (api) , so that a Postfix instance
 could be accessed programmaticaly, say, a C program?

Currently,  all the SUPPORTED interfaces require that non-Postfix
code communicates with Postfix via some protocol:  examples are
the SMTP protocol, the pipe-to-command protocol, the SMTPD policy
protocol, the Milter protocol, and a simple TCP-based lookup table.

 for example, connect to a Postfix instance and validate if an e-mail
 address is a valid recipient  for the specific instance...

You can already do this with the existing SMTP interface.

Wietse