Вопрос

In manually you need to create a hotspot link if you want to send a reference to a file on a network drive. Is it possible to send an e-mail programatically by Java agent with the same link?

(In mimeentity can be used for this purpose, but I am not sure.)

Это было полезно?

Решение

Jake Howlett created a nice Java Class for sending HTML E-Mails which you can find here: http://www.codestore.net/store.nsf/unid/BLOG-20100108-0129 This can be used to generate a HTML link to the file.

Otherwise you can use the RichTextItem class and write a file:// link . Notes Mail will display this a s aclickable hotspot link.

This is a modified sample code (originally from from the notes help) which works on my machine:

import lotus.domino.*;
import java.util.Vector;

public class JavaAgent extends AgentBase {
public void NotesMain() {
    try {      Session session = getSession();
    AgentContext agentContext = session.getAgentContext();
    // (Your code goes here) 
    Database db = agentContext.getCurrentDatabase();
    Document doc = db.createDocument();
    Item subject = doc.replaceItemValue("Subject","Rich text item");
    RichTextItem body = doc.createRichTextItem("Body");
    body.appendText("Link:");
    body.addNewLine(2);
    body.appendText("file://c:\\temp"); //ENTER PATH TO LINK TO HERE
    // Save the document
    doc.save(true, true);
    doc.send("ENTER YOUR MAIL ADDRESS HERE");
    } catch(Exception e) {
        e.printStackTrace();
    }}}

In my original post I had a mistake with escaping the \ of the path (you must use \)

Hope this helps.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top