log4j.debug(smtpHost + "\n" + from + "\n" + to + "\n" + data[0].mailsubject + "\n"
+ data[0].mailtext);
if (log4j.isDebugEnabled())
log4j
.debug("*************************************************************************************************");
EMail email = new EMail(vars, smtpHost, from, to, data[0].mailsubject, data[0].mailtext);
msg = email.send();
if ("OK".equals(msg)) {
RequestActionData.update(conn, this, Utility.messageBD(this, "RequestActionEMailOK", vars
.getLanguage()), strKey);
} else {
RequestActionData.update(conn, this, Utility.messageBD(this, "RequestActionEMailError",
vars.getLanguage())
+ " - " + msg, strKey);
}
} else if (data[0].actiontype.equals("T")) {
String subject = Utility.messageBD(this, "RequestActionTransfer", vars.getLanguage());
RequestActionData.update(conn, this, subject, strKey);
String smtpHost = EmailData.selectSMTPHost(conn, this, data[0].adClientId);
String to = "";
EmailData[] dataTo = EmailData.selectEmail(conn, this, data[0].adUserId);
if (dataTo != null && dataTo.length > 0) {
to = dataTo[0].email;
}
to = to.trim().toLowerCase();
for (int pos = to.indexOf(" "); pos != -1; pos = to.indexOf(" "))
to = to.substring(0, pos) + to.substring(pos + 1);
if (to.equals("")) {
to = System.getProperty("user.name") + "@"
+ Utility.getContext(this, vars, "#AD_Client_Name", windowId) + ".com";
to = to.trim().toLowerCase();
for (int pos = to.indexOf(" "); pos != -1; pos = to.indexOf(" "))
to = to.substring(0, pos) + to.substring(pos + 1);
}
String from = "";
EmailData[] mails = EmailData.selectEmail(conn, this, data[0].updatedby);
if (mails == null || mails.length == 0) {
mails = EmailData.selectEmailRequest(conn, this, data[0].adClientId);
if (mails != null && mails.length > 0) {
from = mails[0].email;
from = from.trim().toLowerCase();
for (int pos = from.indexOf(" "); pos != -1; pos = from.indexOf(" "))
from = from.substring(0, pos) + from.substring(pos + 1);
vars.setSessionValue("#Request_EMail", from);
vars.setSessionValue("#Request_EMailUser", mails[0].emailuser);
vars.setSessionValue("#Request_EMailUserPw", mails[0].emailuserpw);
}
} else {
from = mails[0].email;
from = from.trim().toLowerCase();
for (int pos = from.indexOf(" "); pos != -1; pos = from.indexOf(" "))
from = from.substring(0, pos) + from.substring(pos + 1);
vars.setSessionValue("#User_EMail", from);
vars.setSessionValue("#User_EMailUser", mails[0].emailuser);
vars.setSessionValue("#User_EMailUserPw", mails[0].emailuserpw);
}
if (from.equals("")) {
from = System.getProperty("user.name") + "@"
+ Utility.getContext(this, vars, "#AD_Client_Name", windowId) + ".com";
from = from.trim().toLowerCase();
for (int pos = from.indexOf(" "); pos != -1; pos = from.indexOf(" "))
from = from.substring(0, pos) + from.substring(pos + 1);
}
String message = subject + "\n" + data[0].summary;
if (log4j.isDebugEnabled())
log4j
.debug("*************************************************************************************************");
if (log4j.isDebugEnabled())
log4j.debug(smtpHost + "\n" + from + "\n" + to + "\n" + subject + "\n" + message);
if (log4j.isDebugEnabled())
log4j
.debug("*************************************************************************************************");
EMail email = new EMail(vars, smtpHost, from, to, subject, message);
email.send();
}
releaseCommitConnection(conn);
} catch (Exception e) {
try {