try {
oAddr = oConn.prepareStatement(sSQL, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
ResultSet oRSet;
InternetAddress oInetAdr;
String sTxEmail, sGuCompany, sGuContact, sTxName, sTxSurname1, sTxSurname2, sTxPersonal;
// Get From address and keep them into pFrom properties
if (oFrom!=null) {
oAddr.setString(1, oFrom.getAddress());
oAddr.setString(2, sGuWorkArea);
oAddr.setString(3, oFrom.getAddress());
oAddr.setString(4, oFrom.getAddress());
oAddr.setString(5, oFrom.getAddress());
oAddr.setString(6, sGuWorkArea);
oRSet = oAddr.executeQuery();
if (oRSet.next()) {
sGuContact = oRSet.getString(1);
if (oRSet.wasNull()) sGuContact = "null";
sGuCompany = oRSet.getString(2);
if (oRSet.wasNull()) sGuCompany = "null";
if (sGuCompany.equals("****************************USER")) {
sTxName = oRSet.getString(3);
if (oRSet.wasNull()) sTxName = "";
sTxSurname1 = oRSet.getString(4);
if (oRSet.wasNull()) sTxSurname1 = "";
sTxSurname2 = oRSet.getString(4);
if (oRSet.wasNull()) sTxSurname2 = "";
sTxPersonal = Gadgets.left(sTxName+" "+sTxSurname1+" "+sTxSurname2, 254).replace(',',' ').trim();
}
else
sTxPersonal = "null";
if (DebugFile.trace) DebugFile.writeln("from "+sGuContact+","+sGuCompany+","+sTxPersonal);
pFrom.put(oFrom.getAddress(), sGuContact+","+sGuCompany+","+sTxPersonal);
}
else
pFrom.put(oFrom.getAddress(), "null,null,null");
oRSet.close();
} // fi (oFrom)
if (DebugFile.trace) DebugFile.writeln("from count = " + pFrom.size());
// Get TO address and keep them into pTo properties
if (oTo!=null) {
for (int t=0; t<oTo.length; t++) {
oInetAdr = (InternetAddress) oTo[t];
sTxEmail = Gadgets.left(oInetAdr.getAddress(), 254);
oAddr.setString(1, sTxEmail);
oAddr.setString(2, sGuWorkArea);
oAddr.setString(3, sTxEmail);
oAddr.setString(4, sTxEmail);
oAddr.setString(5, sTxEmail);
oAddr.setString(6, sGuWorkArea);
oRSet = oAddr.executeQuery();
if (oRSet.next()) {
sGuContact = oRSet.getString(1);
if (oRSet.wasNull()) sGuContact = "null";
sGuCompany = oRSet.getString(2);
if (oRSet.wasNull()) sGuCompany = "null";
if (sGuCompany.equals("****************************USER")) {
sTxName = oRSet.getString(3);
if (oRSet.wasNull()) sTxName = "";
sTxSurname1 = oRSet.getString(4);
if (oRSet.wasNull()) sTxSurname1 = "";
sTxSurname2 = oRSet.getString(4);
if (oRSet.wasNull()) sTxSurname2 = "";
sTxPersonal = Gadgets.left(sTxName+" "+sTxSurname1+" "+sTxSurname2, 254).replace(',',' ').trim();
}
else
sTxPersonal = "null";
pTo.put(sTxEmail, sGuContact+","+sGuCompany+","+sTxPersonal);
} // fi (oRSet.next())
else
pTo.put(sTxEmail, "null,null,null");
oRSet.close();
} // next (t)
} // fi (oTo)
if (DebugFile.trace) DebugFile.writeln("to count = " + pTo.size());
// Get CC address and keep them into pTo properties
if (oCC!=null) {
for (int c=0; c<oCC.length; c++) {
oInetAdr = (InternetAddress) oCC[c];
sTxEmail = Gadgets.left(oInetAdr.getAddress(), 254);
oAddr.setString(1, sTxEmail);
oAddr.setString(2, sGuWorkArea);
oAddr.setString(3, sTxEmail);
oAddr.setString(4, sTxEmail);
oAddr.setString(5, sTxEmail);
oAddr.setString(6, sGuWorkArea);
oRSet = oAddr.executeQuery();
if (oRSet.next()) {
sGuContact = oRSet.getString(1);
if (oRSet.wasNull()) sGuContact = "null";
sGuCompany = oRSet.getString(2);
if (oRSet.wasNull()) sGuCompany = "null";
if (sGuCompany.equals("****************************USER")) {
sTxName = oRSet.getString(3);
if (oRSet.wasNull()) sTxName = "";
sTxSurname1 = oRSet.getString(4);
if (oRSet.wasNull()) sTxSurname1 = "";
sTxSurname2 = oRSet.getString(4);
if (oRSet.wasNull()) sTxSurname2 = "";
sTxPersonal = Gadgets.left(sTxName+" "+sTxSurname1+" "+sTxSurname2, 254).replace(',',' ').trim();
}
else
sTxPersonal = "null";
pCC.put(sTxEmail, sGuContact+","+sGuCompany+","+sTxPersonal);
} // fi (oRSet.next())
else
pCC.put(sTxEmail, "null,null,null");
oRSet.close();
} // next (c)
} // fi (oCC)
if (DebugFile.trace) DebugFile.writeln("cc count = " + pCC.size());
// Get BCC address and keep them into pTo properties
if (oBCC!=null) {
for (int b=0; b<oBCC.length; b++) {
oInetAdr = (InternetAddress) oBCC[b];
sTxEmail = Gadgets.left(oInetAdr.getAddress(), 254);
oAddr.setString(1, sTxEmail);
oAddr.setString(2, sGuWorkArea);
oAddr.setString(3, sTxEmail);
oAddr.setString(4, sTxEmail);