1

I try to create a button which send a mail using the doc's URL to a mail-adress entered in an editBox:

 if(Contr.isNewNote()){
    Contr.save();
}
var thisdoc = Contr.getDocument(true);
var tempdoc = database.createDocument();
tempdoc.replaceItemValue("Form", "Memo");
tempdoc.replaceItemValue("SendTo", thisdoc.getItemValue("Destinatari"));
tempdoc.replaceItemValue("Subject", "My application");
var tempbody:NotesRichtextItem = tempdoc.createRichTextItem("Body");
tempbody.appendText("Click for open the doc. in client")
tempbody.addNewLine(2);
tempbody.appendDocLink(thisdoc);
tempbody.addNewLine(2);
thisdoc.save(true,true);
tempbody.appendText("click for navigating via web")
tempbody.addNewLine(2);
tempbody.appendText(facesContext.getExternalContext().getRequest().getRequestURL().toString() + 
          "?action=readDocument&documentId=" + thisdoc.getUniversalID());
tempdoc.send();
thisdoc.recycle();
tempbody.recycle();
tempdoc.recycle();

But at tempdoc.send(); I get Exception occurred calling method NotesDocument.send() null

What is weird, is the fact that for an application on the same server the code is working, I just copy the code and just modified the doc datasource and the SendTo field name. Am I missing something? Thanks for your time.

Jim Simson
  • 2,774
  • 3
  • 22
  • 30
Florin M.
  • 2,159
  • 4
  • 39
  • 97

1 Answers1

0

I forget the issue but there's been reports of this problem I think if a bad character gets into the sendTo.

There's a comment on the email bean XSnippet: http://openntf.org/XSnippets.nsf/snippet.xsp?id=emailbean-send-dominodocument-html-emails-cw-embedded-images-attachments-custom-headerfooter

that said: The solution that seems to work is to use the method :

emailHeader.addValText(xxx,"UTF-8")

instead of

emailHeader.setHeaderVal(xxx)

I'm not exactly sure how that might translate to SSJS.. but the problem might be with special characters..

David Leedy
  • 3,583
  • 18
  • 38