This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Jan 2, 2013, 6:51 AM
6 Posts

Sending emails from an xpage using SSJS

  • Category: Server Side JavaScript
  • Platform: Windows
  • Release: 8.5.3
  • Role: Developer
  • Tags: email
  • Replies: 2
 I have an XPage with a button on. The DB is on a local server. The onclick code is:
 
   1: var doc:NotesDocument = database.createDocument();
   2: doc.replaceItemValue("form", "Memo");
   3: doc.replaceItemValue("sendTo", "me@domain.com");
   4: doc.replaceItemValue("subject", "hi there!");
   5: doc.replaceItemValue("body", "content here");
   6: doc.send(); 
 
When I click the button the 6th line produces an error and no mail is sent. 
 
The message is :=

Exception

Error while executing JavaScript action expression
Script interpreter error, line=6, col=5: [TypeError] Exception occurred calling method NotesDocument.send(string) null 
 
Any idea as to why this is? I've also tried the following without result:
 
   6: doc.send("me@domain.com"); 
 
Thanks for any help. 
 
Nov 19, 2013, 8:54 PM
18 Posts
also getting this error

I have tried all the suggestions, but am still getting that same Exception error.

It's not a problem with access, as I can send a blank email from the same database with different code.  I want to email an existing document with a "Send" button on an xPage.  I don't need to create a new mail memo (although I've tried this also).  I can save the email, and it's perfect:  the SendTo and all the fields are there!  But I get an error on doc.send() or doc.send(address).  My code is similar to Steve's, but I don't need to use replaceItemValue, as I'm emailing the document that's open.

I have added saves for the currentDocument and back-end doc object, but still send() throws the error.


This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal