Auto import LDAP User on first email to rt

Hi All,

This one was a little mopre difficult and will need your own
customizations - sorry.

It is also not well tested and may not work for you at all.

I don;t know if the script is perfect perhaps someone with more tiome
spent on RT could correct any errors in it, but it works for me.

Place LDAPMail.pm in ~rt3/lib/RT/Interface/Email/Auth/

Place EmailParser_Local.pm in ~rt3/lib/RT/

The lookupexternaluserinfo in EmailParser_Local is NOT mine , it was taken
from some messages I found in the RT mailing list archives or contrib - I
am sorry I did not record where I got it from, but if the original author
emails me I will make sure he gets credit and repost the file.

Ypou will need to ensure the ldapsettings in that file are correct
INCLUDING the mappings located at around line 90.

You will also need to add

@RT::MailPlugins = (
“Auth::LDAPMail”,
“Auth::MailFrom”
);

into ~rt3/etc/RT_Site_Config.pm

Basically when a mail message comes in it gets parsed through LDAPMail
first. This looks up user info in the LDAP database and creates the user
with the overridden CreateUser sub routine in LDAPMail (this was so at my
site more info than just email name and ui=d would be added to the RT
database.

Things are then passed of tp the NOrmal MailFrom for normal operation to
continue.

It should be hard to make it so that only people in LDAP can post, or to
make further customizations. It’s a start. If people want to take it and
twist it to do their bidding, please do, I ahave only posted it here in
the hope it saves someone some work.

Stewart

LDAPMail.pm (6.62 KB)

EmailParser_Local.pm (3.71 KB)