Rewriting mail to mailhost

Hi,

For routing messages to a list server, I need to rewrite an address according mailhost parameter.

For example, list1@domain.sample (mailhost=listhost.domain.sample the mbox of this list is located on listhost.domain.sample)

the mail should become list1@listhost.domain.sample

thanks for help me to write rule in imta.conf

SUNJES2005Q4 on Linux AS3

Philippe

[404 byte] By [P_EHRLE] at [2007-11-26 11:22:05]
# 1
Why do you think you need to rewrite the message? Set the value of "mailhost" to the host you want the message processed on. done.
jay_plesset at 2007-7-7 3:37:27 > top of Java-index,E-Mail, Calendar, & Collaboration,Sun Java System Messaging Server...
# 2

Hi,

Although it _may_ be possible to rewrite an address to <user>@<mailhost> for a specific domain (I had a quick play around but couldn't get this to work), any such rule is likely to be complicated and prone to problems down the track.

Much better to use the mailroutingaddress: attribute. This will rewrite the address to whatever you specify and delivery via normal channels.

e.g. mailroutingaddress: list1@listhost.domain.sample

Regards,

Shane.

shane_hjorth at 2007-7-7 3:37:28 > top of Java-index,E-Mail, Calendar, & Collaboration,Sun Java System Messaging Server...
# 3

Thanks for your help,

>Set the value of "mailhost" to the host you want the message processed on.

Yes, mailhost attribute is already set to this value.

>Much better to use the mailroutingaddress: attribute. This will rewrite the address to whatever you specify and delivery via normal channels.

>e.g. mailroutingaddress: list1@listhost.domain.sample

Yes, a good idea to solve it. But creation lists are scripted ...

I think also that a rule like :

$* $A$E$F$U%$TYOZNHZ$V$H@store1.in.DOMAIN.fr

store1.in.DOMAIN.fr $U%$D@store1.in.DOMAIN.fr

DOMAIN.fr $U%$SSM%LDD@store1.in.DOMAIN.fr

may be possible ...

mailhost attribute is my destination host :

dn: cn=liste-test2,ou=listes,ou=DOMAIN,ou=education,o=gouv,c=fr

objectClass: top

objectClass: groupofuniquenames

objectClass: mailgroup

objectClass: mailgroupmanagement

objectClass: groupofurls

objectClass: educationnationale

ou: ou=listes

ou: DOMAIN

ou: education

labeledUri: http://sympa.DOMAIN.fr/wws/info/liste-test2

cn: liste-test2

diffusion: 1

*****************************

mailHost: sympa.DOMAIN.fr

*****************************

mail: liste-test2@DOMAIN.fr

description: liste pour tests interne 2

But, when i test the destination :

/opt/sun/messaging/sbin/imsimta test -rew liste-test2@ac-reims.fr

forward channel= l

channel description=

channel user filter=

dest channel filter=

source channel filter =

channel flags #0= BIDIRECTIONAL MULTIPLE IMMNONURGENT NOSERVICEALL

channel flags #1= NOSMTP DEFAULT

channel flags #2= COPYSENDPOST COPYWARNPOST POSTHEADONLY HEADERINC NOEXPROUTE

channel flags #3= LOGGING NOGREY NORESTRICTED RETAINSECURITYMULTIPARTS

channel flags #4= EIGHTBIT NOHEADERTRIM NOHEADERREAD RULES

channel flags #5=

channel flags #6= LOCALUSER REPORTNOTARY

channel flags #7= NOSWITCHCHANNEL NOREMOTEHOST DATEFOUR DAYOFWEEK

channel flags #8= NODEFRAGMENT EXQUOTA REVERSE NOCONVERT_OCTET_STREAM

channel flags #9= NOTHURMAN INTERPRETENCODING USEINTERMEDIATE RECEIVEDFROM VALIDATELOCALSYSTEM NOTURN

defaulthost= DOMAIN.fr DOMAIN.fr

linelength = 1023

channel env addr type = SOURCEROUTE

channel hdr addr type = SOURCEROUTE

channel official host = store1.in.DOMAIN.fr

channel queue 0 name= LOCAL_POOL

channel queue 1 name= LOCAL_POOL

channel queue 2 name= LOCAL_POOL

channel queue 3 name= LOCAL_POOL

channel after params=

channel user name=

urgentnotices = 1 2 4 7

normalnotices = 1 2 4 7

nonurgentnotices= 1 2 4 7

channel rightslist ids =

local behavior flags= %x7

expandchannel =

notificationchannel=

dispositionchannel=

saslswitchchannel=

tlsswitchchannel=

backward channel= l

header To: address= liste-test@DOMAIN.fr

header From: address= liste-test@DOMAIN.fr

envelope To: address= liste-test@DOMAIN.fr (route (store1.in.DOMAIN.fr,store1.in.DOMAIN.fr)) (host DOMAIN.fr)

envelope From: address = liste-test@DOMAIN.fr

name=

mbox= liste-test

Extracted address action list:

liste-test@DOMAIN.fr

Extracted 733 address action list:

liste-test@DOMAIN.fr

Address list expansion:

0 expansion total.

Expanded address:

liste-test@DOMAIN.fr

Submitted address list:

Address list error -- 5.1.1 unknown or illegal alias: liste-test@DOMAIN.fr

my imta.conf is :

!

! IMTA configuration file

!

! part I : rewrite rules

!

! Domain Rewrite Rules.

! Uncomment this line to use domain rewrite rules

! from the configuration file instead of the domain database.

! Please refer to the iMS documentation for details.

!<IMTA_TABLE:domains.rules

!

! Rules to select local users

iprof.DOMAIN.fr $U%$D@ store1.in.DOMAIN.fr

!

! ims-ms

.ims-ms-daemon $U%$H.ims-ms-daemon@ims-ms-daemon

!

! lmtp

!.lmtp $U%$H@lmtpcs-daemon

!

! lmtpn

!.lmtpn $U%$H@lmtpcn-daemon

!

! native

.native-daemon $U%$H.native-daemon@native-daemon

!

! pipe

.pipe-daemon $U%$H.pipe-daemon@pipe-daemon

!

! tcp_local

! Rules for top level internet domains

><IMTA_TABLE:internet.rules

!

! tcp_intranet

! Do mapping lookup for internal IP addresses

[] $E$R${INTERNAL_IP,$L}$U%[$L]@tcp_intranet-daemon

.DOMAIN.fr $U%$H.DOMAIN.fr@tcp_intranet-daemon

* $U%$&0.DOMAIN.fr

!

! reprocess

reprocess $U%reprocess.store1.in.DOMAIN.fr@reprocess-daemon

reprocess.store1.in.DOMAIN.fr $U%reprocess.store1.in.DOMAIN.fr@reprocess-daemon

!

! process

process $U%process.store1.in.DOMAIN.fr@process-daemon

process.store1.in.DOMAIN.fr $U%process.store1.in.DOMAIN.fr@process-daemon

!

! defragment

defragment $U%defragment.store1.in.DOMAIN.fr@defragment-daemon

defragment.store1.in.DOMAIN.fr $U%defragment.store1.in.DOMAIN.fr@defragment-daemon

!

! conversion

conversion $U%conversion.store1.in.DOMAIN.fr@conversion-daemon

conversion.store1.in.DOMAIN.fr $U%conversion.store1.in.DOMAIN.fr@conversion-daemon

!

! bitbucket

bitbucket $U%bitbucket.store1.in.DOMAIN.fr@bitbucket-daemon

bitbucket.store1.in.DOMAIN.fr $U%bitbucket.store1.in.DOMAIN.fr@bitbucket-daemon

!

! deleted

deleted-daemon $U%$H@deleted-daemon

.deleted-daemon $U%$H@deleted-daemon

!

! inactive

inactive-daemon $U%$H@inactive-daemon

.inactive-daemon $U%$H@inactive-daemon

!

! hold

hold-daemon $U%$H@hold-daemon

.hold-daemon $U%$H@hold-daemon

!

! part II : channel blocks

!

defaults logging notices 1 2 4 7 copywarnpost copysendpost postheadonly noswitchchannel immnonurgent maxjobs 7 defaulthost DOMAIN.fr DOMAIN.fr

!

! delivery channel to local /var/mail store

l subdirs 20 viaaliasrequired maxjobs 7 pool LOCAL_POOL

store1.in.DOMAIN.fr

!

! ims-ms

ims-ms defragment subdirs 20 notices 1 7 14 21 28 backoff "pt5m" "pt10m" "pt30m" "pt1h" "pt2h" "pt4h" maxjobs 2 pool IMS_POOL fileinto $U+$S@$D

ims-ms-daemon

!

! native

native defragment subdirs 20 maxjobs 1

native-daemon

!

! pipe

pipe single defragment subdirs 20

pipe-daemon

!

! tcp_local

tcp_local smtp nomx daemon smtp.DOMAIN.fr port 25 single_sys remotehost inner switchchannel identnonenumeric subdirs 20 maxjobs 7 pool SMTP_POOL maytlsserver maysaslserver

-

Regards,

Philippe>

PE_ at 2007-7-7 3:37:28 > top of Java-index,E-Mail, Calendar, & Collaboration,Sun Java System Messaging Server...
# 4

Hi,

Ok let's backup.

What software is the list-server running?

Why exactly do you thing you need to rewrite the address?

By default messaging server will relay the message to mailhost specified and then the list-server (assuming its running sun messaging server) will receive the email and expand the recipients.

> mailhost attribute is my destination host :

>

> dn:

> cn=liste-test2,ou=listes,ou=DOMAIN,ou=education,o=gouv

> ,c=fr

> objectClass: top

> objectClass: groupofuniquenames

> objectClass: mailgroup

> objectClass: mailgroupmanagement

> objectClass: groupofurls

> objectClass: educationnationale

> ou: ou=listes

> ou: DOMAIN

> ou: education

> labeledUri:

> http://sympa.DOMAIN.fr/wws/info/liste-test2

> cn: liste-test2

> diffusion: 1

> *****************************

> mailHost: sympa.DOMAIN.fr

> *****************************

> mail: liste-test2@DOMAIN.fr

> description: liste pour tests interne 2

Regards,

Shane.

shane_hjorth at 2007-7-7 3:37:28 > top of Java-index,E-Mail, Calendar, & Collaboration,Sun Java System Messaging Server...
# 5

HI,

>What software is the list-server running?

http://www.sympa.org/

>Why exactly do you thing you need to rewrite the address?

Users send mail to <listname>@<DOMAIN> and not <name>@<hostlists>.<DOMAIN>

(it works fine on a front postfix system : ldaptransport_result_filter = %u@sympa.DOMAIN )

IMTA (store1) is unable to send mail to an address with mailhost=<hostlists>.<DOMAIN>

->Address list error -- 5.1.1 unknown or illegal alias: liste-test@DOMAIN.fr

>By default messaging server will relay the message to mailhost specified and then the >list-server (assuming its running sun messaging server) will receive the email and expand the recipients.

Is it possible that mecanism was damaged in my imta.conf ?

Philippe

P_EHRLE at 2007-7-7 3:37:28 > top of Java-index,E-Mail, Calendar, & Collaboration,Sun Java System Messaging Server...
# 6
Do you have a "user" or other LDAP entry that matcheslist@your.domain?If not, Messaging Server will reject that address. Please create such an entry, use your list box as mailhost.
jay_plesset at 2007-7-7 3:37:28 > top of Java-index,E-Mail, Calendar, & Collaboration,Sun Java System Messaging Server...
# 7

Hi,

yes I have :

ldapsearch -x -s sub -LLL -b "o=gouv,c=fr" -h proxyldap.in.DOMAIN.fr -p 389 '(mail=liste-test2@*)'

dn: cn=liste-test2,ou=listes,ou=DOMAIN,ou=education,o=gouv,c=fr

objectClass: top

objectClass: groupofuniquenames

objectClass: mailgroup

objectClass: mailgroupmanagement

objectClass: groupofurls

objectClass: educationnationale

ou: ou=listes

ou: DOMAIN

ou: education

labeledUri: http://sympa.DOMAIN.fr/wws/info/liste-test2

cn: liste-test2

diffusion: 1

mailHost: sympa.DOMAIN.fr

mail: liste-test2@DOMAIN.fr

description: liste pour tests interne 2

thanks,

philippe

P_EHRLE at 2007-7-7 3:37:28 > top of Java-index,E-Mail, Calendar, & Collaboration,Sun Java System Messaging Server...
# 8

Hi,

I think there is some confusion because you said:

>> IMTA (store1) is unable to send mail to an address with

>> mailhost=<hostlists>.<DOMAIN>

>> ->Address list error -- 5.1.1 unknown or illegal alias: liste-test@DOMAIN.fr

(note the lack of 2 at the end of liste-test)

And the LDAP entry is for:

mail: liste-test2@DOMAIN.fr

So in this case it's no surprise that it doesn't work since the addresses are actually different.

Regards,

Shane

shane_hjorth at 2007-7-7 3:37:28 > top of Java-index,E-Mail, Calendar, & Collaboration,Sun Java System Messaging Server...
# 9

Sorry,

the effective test is :

[root@store1 root]# /opt/sun/messaging/sbin/imsimta test -rew liste-test2@DOMAIN.fr

forward channel= l

channel description=

channel user filter=

dest channel filter=

source channel filter =

channel flags #0= BIDIRECTIONAL MULTIPLE IMMNONURGENT NOSERVICEALL

channel flags #1= NOSMTP DEFAULT

channel flags #2= COPYSENDPOST COPYWARNPOST POSTHEADONLY HEADERINC NOEX PROUTE

channel flags #3= LOGGING NOGREY NORESTRICTED RETAINSECURITYMULTIPARTS

channel flags #4= EIGHTBIT NOHEADERTRIM NOHEADERREAD RULES

channel flags #5=

channel flags #6= LOCALUSER REPORTNOTARY

channel flags #7= NOSWITCHCHANNEL NOREMOTEHOST DATEFOUR DAYOFWEEK

channel flags #8= NODEFRAGMENT EXQUOTA REVERSE NOCONVERT_OCTET_STREAM

channel flags #9= NOTHURMAN INTERPRETENCODING USEINTERMEDIATE RECEIVEDF ROM VALIDATELOCALSYSTEM NOTURN

defaulthost= DOMAIN.fr DOMAIN.fr

linelength = 1023

channel env addr type = SOURCEROUTE

channel hdr addr type = SOURCEROUTE

channel official host = store1.in.DOMAIN.fr

channel queue 0 name= LOCAL_POOL

channel queue 1 name= LOCAL_POOL

channel queue 2 name= LOCAL_POOL

channel queue 3 name= LOCAL_POOL

channel after params=

channel user name=

urgentnotices = 1 2 4 7

normalnotices = 1 2 4 7

nonurgentnotices= 1 2 4 7

channel rightslist ids =

local behavior flags= %x7

expandchannel =

notificationchannel=

dispositionchannel=

saslswitchchannel=

tlsswitchchannel=

backward channel= l

header To: address= liste-test2@DOMAIN.fr

header From: address= liste-test2@DOMAIN.fr

envelope To: address= liste-test2@DOMAIN.fr (route (store1.in.DOMAIN.f r,store1.in.DOMAIN.fr)) (host DOMAIN.fr)

envelope From: address = liste-test2@DOMAIN.fr

name=

mbox= liste-test2

Extracted address action list:

liste-test2@DOMAIN.fr

Extracted 733 address action list:

liste-test2@DOMAIN.fr

Address list expansion:

0 expansion total.

Expanded address:

liste-test2@DOMAIN.fr

Submitted address list:

Address list error -- 5.1.1 unknown or illegal alias: liste-test2@DOMAIN.fr

Submitted notifications list:

-

For ldap entry : mail:list-test2@DOMAIN.fr

(Nov 13, 2006 12:49 AM (reply 7 ..))

thanks,

Philippe

P_EHRLE at 2007-7-7 3:37:28 > top of Java-index,E-Mail, Calendar, & Collaboration,Sun Java System Messaging Server...