?
Solved

images in mime format message

Posted on 2003-02-25
4
Medium Priority
?
408 Views
Last Modified: 2013-12-18
How can I read the content-id of an image in a body message that is in mime format?

I can get the child/content type and sub-type i.e image/gif for instance plus the actual image content. I however need the CONTENT-ID for referencing purposes in displaying my final output.

Is there a method in the MIMEEntity class or anywhere else like getContentAsText() or getContentType() etc that can be used but to get the content-id instead?

Thx

0
Comment
Question by:jdembare
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 7

Expert Comment

by:scottrma
ID: 8021877
Use NotesMIMEEntity.ContentAsText property and then search the string returned by this property for content-id. For example, I use the following subroutine to concatenate all the header parts into a string called HeadersTextStr and all the content parts into a string called BodyTextStr:

(Declarations)
Dim HeadersTextStr As String
Dim BodyTextStr As String

Sub Concatenate
     
     Dim mime As NotesMIMEEntity
     Dim mime2 As NotesMIMEEntity
     
     s.ConvertMime = False
     HeadersTextStr = ""
     BodyTextStr = ""
     Set item = doc.GetFirstItem("Body")
     If Not (item.Type = MIME_PART) Then
          Exit Sub
     End If
     Set mime = item.GetMimeEntity
     
     While Not (mime Is Nothing)
          If Lcase$(mime.ContentType) = "text" Then
               HeadersTextStr = HeadersTextStr & mime.Headers
               BodyTextStr = BodyTextStr & mime.ContentAsText
          End If
          Set mime2 = mime.GetFirstChildEntity
          If mime2 Is Nothing Then
               Set mime2 = mime.GetNextSibling
          End If
          If mime2 Is Nothing Then
               Set mime2 = mime.GetParentEntity
               If Not (mime2 Is Nothing) Then
                    Set mime2 = mime2.GetNextSibling
               End If
          End If
          Set mime = mime2
     Wend
     
End Sub

I can then search the HeadersTextStr and BodyTextStr for whatever substrings I want:

Sub CheckMimeBody
     If Instr(1,BodyTextStr,"content-id",5) Then
          'Do some processing here
     End If
End Sub

Hope this helps.

Scott
0
 

Author Comment

by:jdembare
ID: 8027339
Thanks Scott worked fine however I realized that I left the setting part as well. I can't seem to then set the content-ID value of the new document I am creating. I tried setContentFromText(stream...) function but obviously this it is not recognised as a header setting.Part of my code is:

Stream stream = session.createStream();
MIMEEntity body = doc.createMIMEEEntity();
MIMEHeader header = body.createHeader("Content-Type");
header.setHeaderVal("multipart/mixed");
....
MIMEEntity child = body.createChildEntity();
stream.writeText(THE CONTENT-ID VALUE);
child.setContentFromText(stream,"image/gif",MIMEEntity.ENC_BASE64);

Obviously this isn't setting the header values coz when I read the headers of the new document it's returning:

Content-Transfer-Encoding: base64
Content-Type: image/gif

So I am still missing the content-id value in the header. How can i set this value maybe with something like setHeaderVal or what?

Thanks so much for the 1st pointer Scott.

jay


0
 
LVL 7

Accepted Solution

by:
scottrma earned 150 total points
ID: 8039260
Hmmm, I don't recognize CreateStream() as a LotusScript function, is this a VB function? Although LotusScript is essentially derived from VB, the majority of my expertise is in LotusScript, so I am not sure how much I can help you here.

You may want to check out this technical article on how to connect a socket to a specific port on a server (such as Port 25 on an SMTP server), and then pass data back and forth through the socket:

http://www.codestore.info/A55692/store.nsf/unid/EPSD-587VVX

Although the main example given is written in Java, I am sure you could do the same thing in VB.

Regards,

Scott
0
 

Author Comment

by:jdembare
ID: 8040018
I see ur point but it's getting a bit hectic. stream is just a way of passing any content to the entities I suppose nothing much to it. the real question is can I set the child entity's header value - Content-ID? As u can see that the funciton setContentFromText(...) does set the Content-Type (2nd parameter); and encoding (3rd parameter); All I need is to then set as well the Content-ID.

Will see if I can fit the socket idea in my situation.

NB: code above in java but nothing different or unique to lotuscript.

regards,
jay
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question