I am using the below methode to send e-mails to users from events in an application. Works very will except when I try to send an e-mail to someone outside of the company. Can someone tell me what I am doing wrong???
public String sendMailANon(String strPrincipal, String strTo, String strCC, String strBCC, String strSubject, String strUNID, String strStatus, String strCustomerName)
{
try {
Session curSession = getSession();
AgentContext agentContext = curSession.getAgentContext();
Database curDb = agentContext.getCurrentDatabase();
Document contextDoc = agentContext.getDocumentContext();
String mailSendTo = strTo;
String mailSubject = strSubject;
String mailBody1 = "A " + strStatus + " form has been submitted for " + strCustomerName + "";
String mailBody2 = "" + "To open the " + strStatus + " form click on the below URL Link";
String mailBody3 = "" + "/enhancedservices/esf.nsf/UNID2/" + strUNID + "?EditDocument";
String mailBody = mailBody1 + " " + mailBody2 + " " + mailBody3;
Document memo = curDb.createDocument();
memo.appendItemValue("Form", "Memo");
memo.appendItemValue("Principal", strPrincipal);
memo.appendItemValue("From", strPrincipal);
memo.appendItemValue("AltFrom", strPrincipal);
memo.appendItemValue("SendFrom", strPrincipal);
memo.appendItemValue("INetFrom", strPrincipal);
memo.appendItemValue("tmpDisplaySentBy", strPrincipal);
memo.appendItemValue("tmpDisplayFrom_Preview", strPrincipal);
memo.appendItemValue("DisplaySent", strPrincipal);
Item textItemTo = memo.replaceItemValue("SendTo", strTo);
Item textItemCC = memo.replaceItemValue("CopyTo", strCC);
Item textItemBCC = memo.replaceItemValue("BlindCopyTo", strBCC);
memo.appendItemValue("Subject", strSubject);
RichTextItem rti = memo.createRichTextItem("Body");
RichTextStyle header = curSession.createRichTextStyle();
header.setBold(RichTextStyle.YES);
header.setColor(RichTextStyle.COLOR_DARK_BLUE);
header.setEffects(RichTextStyle.EFFECTS_SHADOW);
header.setFont(RichTextStyle.FONT_ROMAN);
header.setFontSize(14);
RichTextStyle byline = curSession.createRichTextStyle();
byline.setBold(RichTextStyle.YES);
byline.setColor(RichTextStyle.COLOR_DARK_BLUE);
byline.setEffects(RichTextStyle.EFFECTS_NONE);
byline.setItalic(RichTextStyle.NO);
byline.setFontSize(10);
RichTextStyle normal = curSession.createRichTextStyle();
normal.setItalic(RichTextStyle.NO);
normal.setBold(RichTextStyle.NO);
normal.setColor(RichTextStyle.COLOR_BLACK);
normal.setUnderline(RichTextStyle.NO);
normal.setStrikeThrough(RichTextStyle.NO);
normal.setFontSize(10);
RichTextStyle underline = curSession.createRichTextStyle();
underline.setUnderline(RichTextStyle.YES);
RichTextStyle strike = curSession.createRichTextStyle();
strike.setStrikeThrough(RichTextStyle.YES);
// Generate Body item
//doc.renderToRTItem(rti);
rti.appendStyle(byline);
rti.appendText(mailBody1);
rti.addNewLine(2);
rti.appendStyle(normal);
rti.appendText(mailBody2);
rti.addNewLine(2);
rti.appendStyle(byline);
rti.appendText(mailBody3);
rti.appendStyle(normal);
//Vector v = new Vector();
//v.addElement(strTo);
//v.addElement(strCC);
//v.addElement(strBCC);
memo.setEncryptOnSend(true);
memo.setSaveMessageOnSend(true);
memo.setSignOnSend(true);
memo.sign();
//memo.send(true, v);
memo.send(false);
memo.recycle();
return "OK";
}
catch(Exception e) {
//e.printStackTrace();
return e.getMessage();
}
}