1
votes

I’m trying to send an email using LOTUS NOTES with the help of “domino” dll (Programming language : C#).

I want to attach a mail signature into the body of email. I’m hoping to add a .jpg for the signature. I also have other email body formatting. Hence I have decided to use HTML for styling and attaching the signature. After browsing the web found out that in NotesRichTextStyle there is a property PassThruHTML. The legal values that can be given for it as per this link are (-1), (0), (255).

The ISSUE is that when I set (-1) the app popup a message saying that “Style value must be True, False, or STYLE_NO_CHANGE (YES, NO, or MAYBE for Java)”.

But in c sharp code it accepts only int values but not the values given in the popup.

2

2 Answers

2
votes

If you're just sending email you should look at the NotesMimeEntity classes, and review this website for examples: http://www-01.ibm.com/support/docview.wss?uid=swg21098323

PassThruHTML won't help you much unless you're trying to display custom HTML in a browser when viewing a Notes document or form via Domino.

3
votes

Following is the C# code for the answer given by Ken Pespisa's reference link.

NotesSession LNSession = new NotesSession();
NotesDatabase LNDatabase = null;
NotesDocument LNDocument;
NotesMIMEEntity LNBody;
NotesStream LNStream;
NotesMIMEHeader LNHeader;

try
{
    LNSession.Initialize(txtPassword.Text);
    LNDatabase = LNSession.GetDatabase(txtServer.Text, txtUserName.Text, false);
    LNStream = LNSession.CreateStream();
    LNSession.ConvertMime = false;

    //Create an email
    LNDocument = LNDatabase.CreateDocument();
    LNDocument.ReplaceItemValue("Form", "Memo");
    LNBody = LNDocument.CreateMIMEEntity();

    LNHeader = LNBody.CreateHeader("Subject");
    LNHeader.SetHeaderVal("Add your subject here");

    LNHeader = LNBody.CreateHeader("To");
    LNHeader.SetHeaderVal("Give your recipient email address");

    LNStream.WriteText("<html>");
    LNStream.WriteText("<body bgcolor=\"blue\" text=\"white\">");
    LNStream.WriteText("<table border=\"2\">");
    LNStream.WriteText("<tr>");
    LNStream.WriteText("<td>Hello World!</td>");
    LNStream.WriteText("</tr>");
    LNStream.WriteText("</table>");
    LNStream.WriteText("</body>");
    LNStream.WriteText("</html>");
    LNBody.SetContentFromText(LNStream, "text/HTML;charset=UTF-8", MIME_ENCODING.ENC_IDENTITY_7BIT);
    LNDocument.Send(false);
}
catch (Exception e)
{
    MessageBox.Show(e.Message);
}