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



Aug 19, 2015, 8:03 PM
21 Posts

How to set the From field

  • Category: Server Side JavaScript
  • Platform: Windows
  • Release: 9.0.1
  • Role: Administrator,Developer,End User
  • Tags: email
  • Replies: 5

Hi

 If I send an email from javascript, the email arrives with the From field containing "Anonymous%<Notes domain>@Company.com".  I tried setting the fields "reply-to", "return-path", "From", "Sender", & "Principal".  But that often results in a bounce-back because (I think) it appears that the From address is being spoofed so the email is rejected.  How can I set the From field?

thanks

clem

Aug 20, 2015, 4:21 AM
110 Posts
If you have access to the appropriate mail.box

Then you can try create the mail there. I haven't tried this with SSJS but back in lotusscript I have done this. Just make sure to just save the document. No need to do a send method. The mail.box will route it later.

Aug 20, 2015, 2:18 PM
21 Posts
re: If you have access to the appropriate mail.box

I have used that technique in LotusScript.  Hadn't thought of using that in javaScript.  I'll test that but I seem to think there's a similar issue.  But I'll give it a try.  Thanks!

 

clem

Oct 13, 2015, 2:05 PM
21 Posts
Solution

Thanks for the replies.  I ended up using the mail.box technique.  In case anyone else needs it, here's the code:

 

 Create the body field.

    var body:NotesRichTextItem = doc.createRichTextItem("body");
    body.addNewLine();
    body.appendText("Four score and seven years ");
    body.addNewLine(2);
    body.appendText("ago our fathers brought forth on this continent, );
    body.addNewLine(2);
    body.appendText("a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal..");
    body.addNewLine(2);
    
    var subject = "The Gettysburg Address"
    var emailAddr = "fan@there.com"

    sendEmailViaMailBox(emailAddr, subject, body);

function sendEmailViaMailBox(emailAddr, subj, rtBodyFld){
    
    var mailboxdb:NotesDatabase = sessionAsSigner.getDatabase("<server name>", "mail.box");
    var emaildoc:NotesDocument = mailboxdb.createDocument();
    emaildoc.replaceItemValue("form", "Memo");
    emaildoc.replaceItemValue("sendTo", emailAddr);
    emaildoc.replaceItemValue("Recipients", emailAddr);
    emaildoc.replaceItemValue("subject", subj);
    //emaildoc.replaceItemValue("body", rtBodyFld);
    emaildoc.copyItem(rtBodyFld, "body");
    emaildoc.replaceItemValue("SMTPOriginator", "xyz@abc.com");
    emaildoc.replaceItemValue("From","\"xyz@abc.com\" <xyz@abc.com>");
    emaildoc.replaceItemValue("Principal","\"xyz@abc.com\" <xyz@abc.com>");
    emaildoc.save();
}


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