• Issue with mail adresses when uploading from outlook

  • OpenKM has many interesting features, but requires some configuration process to show its full potential.
OpenKM has many interesting features, but requires some configuration process to show its full potential.
Forum rules: Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
 #29678  by malte
 
Hi!

I have a problem when I upload mails from my outlook (Exchange) to OpenKM with the plugin. All local adresses are shown as follows
Name.png
Name.png (5.97 KiB) Viewed 4290 times
When I save and upload a .msg file the names are fine...
While using OpenKM this aint a big problem, just annoying, but when I try to do a Repository Export it will fail because of whitspace in the mail address.
Can this be resolved using LDAP or is there any other solution for this?

Thank you very much!

Regards
Malte
 #29694  by jllort
 
Could you send us some msg file to test. Basically to be sure I've understood. If you upload *.msg all goes fine, but if same mail - msg - is uploaded from outlook plugin then fails getting mails.
 #29716  by malte
 
The mail upload from outlook does not fail, but it shows the mail as "Exchange Legacy DN" as I was told this is called.
If I paste this legacy DN into Outlook, the name is recognised after a while. OpenKM cannot resolve these Exchance Legacy DNs, because it is neither connected to Exchange, nor to the Outlook global adress list (GAL).

To solve this issue, I wrote a small php script, which will change all these Legacy DN strings into proper mail adresses. Therefore I got an export of the global adress list from our IT as .csv containing all the Exchange Legacy DNs and their corresponding mail adresses.
With these data I can alter the database and change Exchange Legacy DN to normal mail adresses.

If this is useful for anybody I can pubish the script here.

Generally iI think it would be better to make the Outlook Script do this instead of messing with the DB?
 #29869  by malte
 
Here you go. Its written in PHP. I set up a cronjob that will run the script once a minute.
I think with large databases you may better change the select statement to sth. like "SELECT ... WHERE NML_FROM LIKE '%/o' " for better performance.
Code: Select all
<?php
# Change ExchangeDN to Mailadresses
# Malte Küppers
#
# CSV Legacy File Format:        Exchange Legacy DN ; Mailadresse
#
#


# variables
$row = 0;
$legacy_file = "/root/Hilfsdateien/LegacyExchangeDN.txt" # Set to your filepath


if (($handle = fopen($legacy_file, "r")) !== FALSE) {
    while (($data = fgetcsv($handle, 10000, ";")) !== FALSE) {
                $exchdn[$row]=strtoupper($data[0]);     #Exchange Legacy DN
                $mail[$row]=$data[1];                            #Mailadresse
                $row++;

    }
    fclose($handle);
        #echo $row ." lines read";
}

#Open Database Connection
$db = mysqli_connect("127.0.0.1", "<USERNAME>", "<PASSWORD>", "okmdb");
if(!$db)
{
        exit("Verbindungsfehler: ".mysqli_connect_error());
}

# Mail FROM ändern
$ergebnis = mysqli_query($db, "SELECT DISTINCT NML_FROM FROM OKM_NODE_MAIL");
while($row = mysqli_fetch_object($ergebnis)){
                #only adresses that needs to be changed (Starting with /o= )
                if(strpos($row->NML_FROM,"/o")!==false) {

                        $key = array_search(strtoupper($row->NML_FROM), $exchdn);
                        if(is_numeric($key)){
                                echo $row->NML_FROM ." found at Pos #".$key ."<br>";
                                $qry = "UPDATE OKM_NODE_MAIL SET NML_FROM = '".$mail[$key]."' WHERE NML_FROM ='".$row->NML_FROM."';";
                                #echo $qry ."<br><br>";
                                $update = mysqli_query($db,$qry);
                                }
                }
}

# Mail TO ändern
$ergebnis = mysqli_query($db, "SELECT DISTINCT NML_TO FROM OKM_NODE_MAIL_TO");
while($row = mysqli_fetch_object($ergebnis)){
                #Nur Adressen die nicht geändert wurden
                if(strpos($row->NML_TO,"/o")!==false) {

                        $key = array_search(strtoupper($row->NML_TO), $exchdn);
                        if(is_numeric($key)){
                                echo $row->NML_TO ." gefunden an Pos #".$key ."<br>";
                                $qry = "UPDATE OKM_NODE_MAIL_TO SET NML_TO = '".$mail[$key]."' WHERE NML_TO ='".$row->NML_TO."';";
                                #echo $qry ."<br><br>";
                                $update = mysqli_query($db,$qry);
                                }
                }
}
# Mail CC ändern
$ergebnis = mysqli_query($db, "SELECT DISTINCT NML_CC FROM OKM_NODE_MAIL_CC");
while($row = mysqli_fetch_object($ergebnis)){
                #Nur Adressen die nicht geändert wurden
                if(strpos($row->NML_CC,"/o")!==false){

                        $key = array_search(strtoupper($row->NML_CC), $exchdn);
                        if(is_numeric($key)){
                                echo $row->NML_CC ." gefunden an Pos #".$key ."<br>";
                                $qry = "UPDATE OKM_NODE_MAIL_CC SET NML_CC = '".$mail[$key]."' WHERE NML_CC ='".$row->NML_CC."';";
                                #echo $qry ."<br><br>";
                                $update = mysqli_query($db,$qry);
                                }
                }
}


# Mail BCC ändern
$ergebnis = mysqli_query($db, "SELECT DISTINCT NML_BCC FROM OKM_NODE_MAIL_BCC");
while($row = mysqli_fetch_object($ergebnis)){
                #Nur Adressen die nicht geändert wurden
                if(strpos($row->NML_BCC,"/o")!==false){

                        $key = array_search(strtoupper($row->NML_BCC), $exchdn);
                        if(is_numeric($key)){
                                echo $row->NML_BCC ." gefunden an Pos #".$key ."<br>";
                                $qry = "UPDATE OKM_NODE_MAIL_BCC SET NML_BCC = '".$mail[$key]."' WHERE NML_BCC ='".$row->NML_BCC."';";
                                #echo $qry ."<br><br>";
                                $update = mysqli_query($db,$qry);
                                }
                }
}

?>
 #29968  by malte
 
The file corresponding .csv looks like this:
Code: Select all
/o=EMail/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=somefancyname;f.ancy@sample.com
/o=EMail/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=anotherfancyname;an.fancy@othersample.com
/o=EMail/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=m.mueller;m.mueller@mydomain.com
I used sample data for privacy reasons.

About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.