Notesfactory session add signature to mail body

varsha :

I have a successfully working code where i send lotus notes email from java code using notesfactory session

The code is

Document email=db.createDocument();
email.appendItemValue("subject",subjectText);
RichTextItem body=email.createRichTextItem("body");
body.appendText(bodytext);

And so on..

But i have no idea how to add signature to it.

Torsten Link :

The Signature from Lotus Notes is saved in the CalendarProfile in different Items. If the user selected "Richtext" in the Option "Choose the type of signature you would like to use", then the Signature is in a Richtextitem called "Signature_Rich". Then your code would look somehow like this (ATTENTION: I did not check documentation for correct spelling, there might by typos / uppercase / lowercase errors in that code):

Document profile=db.getProfileDocument("CalendarProfile");
if (profile.getItemValueString("SignatureOption") == "3") 
{
  RichTextItem bodySign=(RichTextItem)profile.getFirstItem("Signature_Rich")
  body.appendRTItem(bodySign)
}

If the user selected "Plain Text" in that option, then you would need to append the content from item "Signature_1":

Document profile=db.getProfileDocument("CalendarProfile");
if (profile.getItemValueString("SignatureOption") == "1") 
{
  RichTextItem bodySign=(RichTextItem)profile.getFirstItem("Signature_Rich")
  body.appendText(profile.getItemValueString("Signature_1"));
}

It might be necessary that you add some body.addNewLine(1) in between to get linebreaks / distance between text and signature.

If the user selected "HTML or Image file", then the thing becomes complicated, as in the item "Signature_2" is the path to a file that has to be attached... I leave it up to you to get the code resulting from SignatureOption = "2"

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=293572&siteId=1