How i can send an attachment from Java Agent

Hi everybody,

I have a script to send me an attachment by email with a Java Agent but when the Agent run it doesn’t send the message to my email.

This is my script:

import lotus.domino.*;

import java.util.Vector;

public class JavaAgent extends AgentBase {

public void NotesMain() {



	try {

		

		Session session = getSession();

		AgentContext agentContext = session.getAgentContext();

		Database db=agentContext.getCurrentDatabase();

		Document memo=db.createDocument();

	     memo.appendItemValue("Form", "Memo");

   		memo.appendItemValue("Subject", "Prueba - Por favor verify this");

          RichTextItem rti = memo.createRichTextItem("Body");

           memo.renderToRTItem(rti);

	     RichTextItem body = memo.createRichTextItem("Body");

  		body.appendText("Here is the attachment:");

  		body.addNewLine(2);

  		body.embedObject(EmbeddedObject.EMBED_OBJECT, "", "c:\\ProcesoPNA.pdf", "Proceso");               

          Vector v = new Vector();

	     v.addElement(session.getUserName());

    		v.addElement("Tonny Cardenas");

    		memo.setEncryptOnSend(true);

    		memo.setSaveMessageOnSend(true);

    		memo.setSignOnSend(true);

    		memo.sign();

    		memo.send(true, v);

	} catch(Exception e) {

		e.printStackTrace();

	}

}	

}

What am i doing bad?

Thanks and regards.

Ivan Garcia.

Subject: How i can send with attachment from Java Agent

What are you doing bad? using Java:-).

Seriously, why are you doing this with Java instead of LotusScript?

Subject: RE: How i can send with attachment from Java Agent

Thanks, but how can i do that?

Could you help me, please?. Do you have some script that you can send me?.

Thanks a lot.

Ivan.

Subject: How i can send an attachment from Java Agent

Why this line?:

memo.renderToRTItem(rti)

You are trying to put a picture of a document (memo) onto itself. Also, you have two Java objects, rti and body, both set as memo.createRichTextItem(“Body”). Drop the line where you create the “rti” object and the renderToRTItem() line, and things should improve quite a bit.