Lotus使用HTML中的java脚本记录邮件

问题描述 投票:1回答:1

我正在开发一个应用程序,使用Lotus Notes中的java脚本向一组用户发送邮件。我们正在为用户使用共享邮箱。

当我触发此邮件脚本时,它将从我的个人邮箱发送

是否可以从共享邮箱触发邮件?

<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>
javascript html lotus-notes shared
1个回答
0
投票

更改数据库不会更改发件人。服务器始终将当前用户名放在发件人名称中。您需要将消息直接写入mail.box文件,而不是使用NotesDocument.Send()方法。

见Knut的answer to an earlier question about this。它包含了Karl-Henry Martinsson对脚本的链接,该脚本演示了该技术。不过,这是LoutsScript,所以你必须将该脚本翻译成JavaScript。

对于您的特定问题,Karl-Henry的LotusScript代码中最重要的代码行是:

  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)

和...

   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

其中me.p_principal包含他希望消息来自的地址,以及......

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

请注意,当他想要控制From地址时,他不会调用maildoc.Send()。他只是调用maildoc.Save(),这是有效的,因为他将它保存在mail.box文件中。

© www.soinside.com 2019 - 2024. All rights reserved.