Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 04-17-2008, 10:25 PM   #1
Registered: May 2003
Location: Canada
Distribution: Debian
Posts: 105

Rep: Reputation: 15
Postfix: Rewriting sender email address from ldap lookups


I'm trying to setup postfix to rewrite a sender address from to

Basically just rewriting entire address to the userid's email address from ldap.

Can anyone give me some tips on how I might do this?


Last edited by endfx; 04-17-2008 at 10:29 PM.
Old 04-18-2008, 10:26 AM   #2
Registered: May 2003
Location: Canada
Distribution: Debian
Posts: 105

Original Poster
Rep: Reputation: 15
This is what I've got so far:

canonical_maps = ldap:/etc/postfix/

server_host =
search_base = ...

bind = yes
bind_dn = ...
bind_pw = ...

query_filter = sAMAccountName=%u
result_attribute = mail

I take the above two lines to mean:
find the ldap entry that has sAMAccountName = to the local part of the sender address (eg: userid from userid@pcname).
Use the "mail" entry as the result address. Am I wrong here?

I think it's authenticating just fine but I'm getting the following error in my log file:
warning: dict_ldap_lookup: Search error 9: Partial results and referral received
Apr 18 09:22:15 pcname postfix/cleanup[32577]: warning: 10C2A7BC464: canonical_maps map lookup problem for userid@pcname

This should be a pretty simple task ... any postfix admins have any thoughts?
Old 04-18-2008, 12:48 PM   #3
LQ Guru
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Can you show us a relevant ldap entry?
Old 04-18-2008, 03:53 PM   #4
Registered: May 2003
Location: Canada
Distribution: Debian
Posts: 105

Original Poster
Rep: Reputation: 15
I got it working with a little googling ...

My LDAP server is Active Directory running on MS Server 2003.
I added:

version = 3

to my file and everything started working.
I guess postfix defaults to version 2 and AD on MS Server 2003 uses version 3.

Hopefully this helps someone else out there.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Set sender address with /bin/mail philosophia Programming 1 02-06-2008 09:59 PM
qmail: how can I block emails which have no sender address? hamish Linux - Networking 0 08-16-2006 04:16 PM
Postfix LDAP lookups with Active Directory paul_mat Linux - Networking 1 11-02-2005 08:44 PM
Postfix - Sender address includes localhost buskmann Linux - Software 1 05-04-2005 07:56 AM
Sendmail Domain of sender address does not exist mantiev Linux - Networking 0 05-08-2001 07:58 AM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:11 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration