1

If I send an email from javascript, the email arrives at the destination address with the "From" field containing Anonymous%<Notes domain>@Company.com. I tried setting the fields "reply-to", "return-path", "From", "Sender", & "Principal" with what I want to appear in the "From" field.

But that often results in a bounce-back message because, I believe, it looks like the "From" address is being spoofed (which is actually is but for a good cause!). How can I modify the "From" field?

Here's the code using mail.box that's throwing the error:

    function sendTestEmail(emailAddr){
 print("enter sendTestEmail function");
 print("emailAddr: "+emailAddr);
 var mailboxdb:NotesDatabase = sessionAsSigner.getDatabase("<server>", "mail.box");
 var emaildoc:NotesDocument = mailboxdb.createDocument();
 emaildoc.replaceItemValue("form", "Memo");
 emaildoc.replaceItemValue("sendTo", emailAddr);
 emaildoc.replaceItemValue("subject", "testing email");
 var body:NotesRichTextItem = emaildoc.createRichTextItem("body");
 body.addNewLine();
 body.appendText(" testing from javascript. ");
 emaildoc.replaceItemValue("SMTPOriginator", "support@abc.com");
 emaildoc.replaceItemValue("From","\"support@abc.com\" <support@abc.com>");
 emaildoc.replaceItemValue("Principal","\"support@abc.com\" <support@abc.com>");
 emaildoc.save(true, false);
 print("exiting sendTestEmail function");
}
Clem
  • 395
  • 1
  • 13
  • 1
    Provide some code examples of what you are doing. Also, email headers of the email actually received would be helpful. – Karl Wilbur Aug 19 '15 at 23:17

3 Answers3

0

Set the SMTPOriginator field to the address it should be from. You might still need to populate the From, Sender and Principal as well.

0

Copy the mail into server's database mail.box instead of sending it and set fields "Principal" and "From" to your alternative address.

Have a look at this answer too.

Community
  • 1
  • 1
Knut Herrmann
  • 30,880
  • 4
  • 31
  • 67
  • Thanks Knut. I have used this technique in LotusScript before. I'll give it a try in my SSJS and will update on the results. Thanks! – Clem Aug 20 '15 at 14:22
  • Tried that and am no getting this error: Router: Message 0065B452 contains no recipients – Clem Aug 20 '15 at 18:33
  • Add an item Recipients with the same content as item SentTo to your mail. – Knut Herrmann Aug 21 '15 at 05:17
0

Just another idea, because to me the mail.box idea should be a last resort approach.

If the mail is always to be sent by the same person (e.g. support), you could prepare a draft mail somewhere, for instance in your current database, and have a signed, scheduled agent (LS, Java) that sends the mails out.

I once used a special Extension Manager DLL to rename certain fields in outgoing mails, but I'm not going to propose that idea here...

D.Bugger
  • 2,300
  • 15
  • 19
  • Well, actually that's what I initially tried. I created a 'support' Notes account and signed all the elements with that id. I expected that a raw .send would have the support account's name/email address as the sender. I was surprised when it didn't and eventually posted this question. I would rather not use the mail.box technique but it seems to have worked. – Clem Aug 21 '15 at 18:46