Hi,
I’m sending a MIME mail from a Java class by using the getDocumentByURL method.
The parameter of the method is a URL referencing a servlet on our WebSphere server.
This servlet returns the value in a JSP page.
This works fine but I only obtain a part of my page in the mail.
I explain.
When I test the URL in IE, the result is OK and the JSP returns by the servlet contains all the informations.
But, when the user receives the mail, he only obtains the beginning of the page.
Here is the code:
String httpSource = "http://servername/appli/servletName?param=value
Session s = NotesFactory.createSession(_DominoServer, orb, _User, _Password);
s.setConvertMime(false);
Database mimeDb = s.getDatabase(“”, “mail.box”);
Document mail = mimeDb.getDocumentByURL(httpSource, true);
mail.replaceItemValue(“SendTo”, …);
mail.appendItemValue(“recipients”,…);
…
mail.send();
s.setConvertMime(true);
When I look in the source code of the web page and I save it in a text file, the file has always a size of 2.15 KB.
Any idea?
Subject: Sending Java MIME Mail
Function sendMIMEmail(sendTo As String , instanceView As NotesView , UnprocessedEntryCollection As NotesViewEntryCollection ) As Variant’//*** Called by reportUnProcessedDocuments
On Error Goto sendMIMEmailError
Dim s As New NotesSession
Dim db As NotesDatabase
Dim sendMIMEmailDoc As NotesDocument
Dim mimeRoot As NotesMimeEntity, mime As NotesMimeEntity
Dim header As NotesMimeHeader
Dim stream As NotesStream
Set db = instanceView.Parent
Dim servername As New NotesName(s.CurrentDatabase.Server)
s.ConvertMIME = False ' Do not convert MIME to rich text
Set sendMIMEmailDoc = instanceView.Parent.CreateDocument
sendMIMEmailDoc.Form = "Memo"
sendMIMEmailDoc.Subject = "MIME HTML inline test"
sendMIMEmailDoc.Principal = "System"
'//*** Create main MIME message
Set stream = s.CreateStream
Set MIMERoot = sendMIMEmailDoc.CreateMIMEEntity ' message root
'//*** Create child entities
Set mime = MIMERoot.CreateChildEntity
Set header = MIMERoot.getNthHeader("Content-Type")
Call header.SetHeaderVal("multipart/related")
Dim dbMail As New NotesDatabase( serverName.Common,"mail.box")
Dim memo As notesdocument
Dim Body As NotesRichTextItem
Dim entry As NotesViewEntry
Set memo = dbMail.CreateDocument
Call memo.ReplaceItemValue( "Subject", "Unprocessed Documents " +instanceView.Parent.Title +"'")
Set Body = New NotesRichTextItem(memo, "Body")
Call Body.AppendText("The following Documents were not found in the Master Address Book.\r\nPlease confirm the users access.")
Call stream.WriteText(buildMessageAndLinkHTML(instanceView , "" ))
Call mime.SetContentFromText(stream,"text/html",ENC_NONE)
Call stream.Close
Call sendMIMEmailDoc.Send(False, sendTo)
s.ConvertMIME = True ' Restore conversion
Exit Function
sendMIMEmailError:
agentLog.LogAction( "sendMIMEmailError: Got error " & Error$ & " on line " & Cstr(Erl) & "; Error" & Str(Err) & " :sendMIMEmailError")
Resume Next
End Function