【问题标题】:xpages send mail to a specific addressxpages 将邮件发送到特定地址
【发布时间】:2014-09-04 06:56:56
【问题描述】:

我尝试创建一个按钮,该按钮使用文档的 URL 将邮件发送到在编辑框中输入的邮件地址:

 if(Contr.isNewNote()){
    Contr.save();
}
var thisdoc = Contr.getDocument(true);
var tempdoc = database.createDocument();
tempdoc.replaceItemValue("Form", "Memo");
tempdoc.replaceItemValue("SendTo", thisdoc.getItemValue("Destinatari"));
tempdoc.replaceItemValue("Subject", "My application");
var tempbody:NotesRichtextItem = tempdoc.createRichTextItem("Body");
tempbody.appendText("Click for open the doc. in client")
tempbody.addNewLine(2);
tempbody.appendDocLink(thisdoc);
tempbody.addNewLine(2);
thisdoc.save(true,true);
tempbody.appendText("click for navigating via web")
tempbody.addNewLine(2);
tempbody.appendText(facesContext.getExternalContext().getRequest().getRequestURL().toString() + 
          "?action=readDocument&documentId=" + thisdoc.getUniversalID());
tempdoc.send();
thisdoc.recycle();
tempbody.recycle();
tempdoc.recycle();

但是在tempdoc.send(); 调用方法NotesDocument.send() null 时发生异常

奇怪的是,对于同一服务器上的应用程序,代码正在运行,我只是复制代码并修改了文档datasourceSendTo 字段名称。我错过了什么吗?感谢您的宝贵时间。

【问题讨论】:

  • 想一想,能不能在发送前调试一下 sendTo 的值...
  • 另外,请查看 XPages 日志文件以获取有关发送错误的更多详细信息
  • 需要注意的轻微效率低下:thisdoc.save 不是必需的,如果您将其留在那里,实际上可能会导致代表/保存。当您在第 2 行执行 Contr.save 时,您已经保存了此文档。

标签: xpages xpages-ssjs


【解决方案1】:

我忘记了这个问题,但是我认为如果有坏字符进入 sendTo,就会出现这个问题的报告。

邮件bean XSnippet有评论:http://openntf.org/XSnippets.nsf/snippet.xsp?id=emailbean-send-dominodocument-html-emails-cw-embedded-images-attachments-custom-headerfooter

说: 似乎可行的解决方案是使用该方法:

emailHeader.addValText(xxx,"UTF-8")

而不是

emailHeader.setHeaderVal(xxx)

我不确定这会如何转化为 SSJS.. 但问题可能出在特殊字符上..

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-01-04
    • 1970-01-01
    • 1970-01-01
    • 2022-01-20
    相关资源
    最近更新 更多