1
votes

I am developing an application to send mail to a group of user using java script from Lotus notes. we are using shared mailbox for a user.

When i trigger this mail script it is sending from my personal mailbox

Is it possible to trigger the mail from the shared mailbox?

<script>
function sendEmail()
{
    var notesDatabase;
    var notesSessiona;
    notesSessiona = new ActiveXObject("Notes.NotesSession");
    notesDatabase = notesSessiona.GETDATABASE("staralliancesupport", "");
    notesDatabase.OPENMAIL();
    var mailItem = notesDatabase.CreateDocument();
    mailItem.subject = te.value +" Outage"+" "+text11.value+tex111.value+tex11.value+tex21.value+tex31.value+tex41.value+tex51.value+tex61.value+tex71.value+tex81.value+tex91.value+" "+ text.value+" "+ tex.value+" session down"
    mailItem.sendto = "[email protected]";
    mailItem.copyto = textbox_1.value;
    mailItem.BlindCopyTo = "";
    mailItem.Body = "Dear All,\n\nNote: This e-mail is sent to Star Alliance member carrier contacts, their business partners and provider help desks.\n\nStar Alliance  would like to inform you about the "+ tex.value +" interruption between Star Alliance and-"+" "+te.value+" "+text11.value+tex111.value+tex11.value+tex21.value+tex31.value+tex41.value+tex51.value+tex61.value+tex71.value+tex81.value+tex91.value+" "+ text.value+".\n\nWe are liaising with the airline's service desk to get more information regarding this issue.\n\n--\n\nStar Alliance Support\nEmail support at:	[email protected]\nTelephone contact No: +1877 292 9784\n"
    mailItem.Send (0);
}
</script>
1

1 Answers

0
votes

Changing the database will not change the sender. The server always puts the current username in the sender name. You need to write your message directly to the mail.box file instead of using the NotesDocument.Send() method.

See Knut's answer to an earlier question about this. It contains a link to a script by Karl-Henry Martinsson that demonstrates the technique. It's LoutsScript, though, so you're going to have to translate that script to JavaScript.

For your specific problem, the most important lines of code in Karl-Henry's LotusScript code are:

  Set mailbox = New NotesDatabase(mailservername,"mail.box")
  If mailbox.Isopen = False Then
   Print "mail.box on " & mailservername & " could not be opened"
   Exit Sub
  End If
  Set me.maildoc = New NotesDocument(mailbox)

and...

   If me.p_principal<>"" Then
     Call maildoc.ReplaceItemValue("Principal", me.p_principal)
     ' If principal is set, we want to fix so mail looks like
     ' it is coming from that address, need to set these fields
     Call maildoc.ReplaceItemValue("From", me.p_principal)
     Call maildoc.ReplaceItemValue("Sender", me.p_principal)
     Call maildoc.ReplaceItemValue("ReplyTo", me.p_principal)
     Call maildoc.ReplaceItemValue("SMTPOriginator", me.p_principal)
   End If

where me.p_principal contains the address he wants the message to come from, and...

Call maildoc.Save(True,False) ' Save in mail.box

Note that he doesn't call maildoc.Send() when he wants to control the From address. He just calls maildoc.Save(), and this works because he is saving it in the mail.box file.