oSto = DBStore.open (oHnl.getSession(), oDbb.getProfileName(), sMBoxDir,
oUsr.getString(DB.gu_user), oUsr.getString(DB.tx_pwd));
oFld = oSto.openDBFolder("outbox", DBFolder.READ_WRITE);
System.out.println("Creating message template...");
DBMimeMessage oMsg = DraftsHelper.draftMessage(oFld, oDbb.getProperty("mail.host","127.0.0.1"),
oUsr.getString(DB.gu_workarea),
oUsr.getString(DB.gu_user), sType);
DraftsHelper.draftUpdate (oCon, oUsr.getInt(DB.id_domain),
oUsr.getString(DB.gu_workarea),
oMsg.getMessageGuid(),
DBCommand.queryStr(oCon, "SELECT "+DB.id_message+" FROM "+DB.k_mime_msgs+
" WHERE "+DB.gu_mimemsg+"='"+oMsg.getMessageGuid()+"'"),
oLst.getString(DB.tx_from),
oLst.getStringNull(DB.tx_reply,oLst.getString(DB.tx_from)),
oLst.getStringNull(DB.tx_sender,oLst.getString(DB.tx_from)),
oLst.getStringNull(DB.tx_subject,""),
"text/"+sType+"; charset=utf-8",
sBody, null, null, null);
System.out.println("Message template successfully composed");
String sGuJob = null;
if (null!=oDbb.getProperty("mail.job.title")) {
oStm = oCon.prepareStatement("SELECT "+DB.gu_job+" FROM "+DB.k_jobs+" WHERE "+
DB.tl_job+"=? AND "+DB.gu_workarea+"=?");
oStm.setString(1, oDbb.getProperty("mail.job.title"));
oStm.setString(2, oLst.getString(DB.gu_workarea));
oRst = oStm.executeQuery();
if (oRst.next()) sGuJob = oRst.getString(1);
oRst.close();
oRst=null;
oStm.close();
oStm=null;
} // fi
if (null==sGuJob) {
oSnd = newInstance(oCon, oLst.getString(DB.gu_list),
oLst.getString(DB.gu_workarea),
oUsr.getString(DB.gu_user), dtNow,
Job.STATUS_RUNNING,
oDbb.getProperty("mail.job.title",oLst.getStringNull(DB.de_list,"")+" "+dtNow.toString()),
"profile:"+oDbb.getProfileName()+
",id:"+oMsg.getMessageID()+
",message:"+oMsg.getMessageGuid()+
",account:"+oAcc.getString(DB.gu_account)+
",gu_list:"+oLst.getString(DB.gu_list)+
",personalized:"+String.valueOf(true)+
",bo_attachimages:1");
} else {