hcl-bot
1
Hi
I´d cross certify 2 domains, replicate yours names.nsf and configurated Directory Assistance.
For security reasons i can´t route e-mail through NRPC.
So when i need to send to John Smith/CompanyB@CompanyB, i´d like that router replace this address with john.smith@companyb.com and sent through smtp.
How to do this? Any sugestion?
hcl-bot
2
Subject: Cross Certify and Routing question
Hi
To resolve this problem i create a fake Address Book
Solution:
-
Replicate the address Book from CompanyB to CompanyB\Bnames.nsf
-
Create a database from template Pubnames.nsf as CompanyBnames.nsf
-
In database i create a scheduled agent that:
3a) copy documents from CompanyB\Bnames.nsf to CompanyBNames.nsf
3b) replace the field MailSystem with option 5 “Other Internet Mail”
Agent
import lotus.domino.*;
public class JavaAgent extends AgentBase {
private OpenLogItem oli = new OpenLogItem();
Session session = null;
Database currDb = null;
Database importDb = null;
String mailSystemOtherInternetMail = "5";
String viewName = "($VIMPeople)";
public void NotesMain() {
try {
session = getSession();
AgentContext agentContext = session.getAgentContext();
currDb = agentContext.getCurrentDatabase();
Document profileDoc = currDb.getProfileDocument("SystemParameters","");
String dbName = profileDoc.getItemValueString("NamesDbPath");
String dominoServer = profileDoc.getItemValueString("Servers");
importDb = session.getDatabase(dominoServer, dbName);
if (importDb.isOpen()) {
removeTodosDocumentos();
importaPersonDocs();
defineMailSystem();
} else {
System.out.println(" Database is not open ...");
}
} catch(Exception e) {
e.printStackTrace();
oli.logError(e);
}
}
public void removeTodosDocumentos() throws Exception {
DocumentCollection dc = currDb.getAllDocuments();
//dc.FTSearch("blue");
if (dc.getCount() > 0) {
System.out.println(dc.getCount() + " Removing docs from database ...");
dc.removeAll(true);
}
}
public void importaPersonDocs() throws Exception {
Document doc = null;
View view = importDb.getView(viewName);
doc = view.getFirstDocument();
int count = 0;
while (doc != null) {
if (doc.getItemValueString("Form").equals("Person")) {
doc.copyToDatabase(currDb);
count++;
}
doc = view.getNextDocument(doc);
}
System.out.println("Import PersonDocs [" + importDb.getTitle() + "]- Qtd[" + String.valueOf(count) + "]");
}
public void defineMailSystem() throws Exception {
Document doc = null;
String internetAddress = "";
View view = currDb.getView(viewName);
view.refresh();
doc = view.getFirstDocument();
int count = 0;
while (doc != null) {
if (doc.getItemValueString("Form").equals("Person")) {
doc.replaceItemValue("MailSystem", mailSystemOtherInternetMail);
internetAddress = doc.getItemValueString("InternetAddress").toLowerCase();
if (!internetAddress.equals("")) {
doc.replaceItemValue("InternetAddress", internetAddress);
}
doc.save();
count++;
}
doc = view.getNextDocument(doc);
}
System.out.println("defineMailSystem [" + importDb.getTitle() + "]- Qtd[" + String.valueOf(count) + "]");
}
}
This solution works fine!