I am facing a very weird issue.
I wish to convert one mail of MIME format into .eml file with all the mail content (i.e. headers, text and attachments).
While doing so only first attachment of MIME mail is only available in my new .eml file, I am creating.
I think that while saving the document only first MIME attachment is coming…
Code snippet :-
’
Set nBody = newEmailCopyDoc.CreateMIMEEntity
Set nBodyChild = nBody.CreateChildEntity()
’
'…
Call nStream.Writetext(sMailText)
(In above line sMailText contains all the content of MIME mail for which I am generating .eml file . I checked using debugging that ‘sMailText’ it contains all the attachments content)
Call nBodyChild.SetContentFromText(nStream, “text/plain”, ENC_IDENTITY_8BIT)
Later on I am saving my mail
Call newEmailCopyDoc.save(True,False)
But in output when I check newly generated eml file…it contains only 1 attachments , trimming all other attachments.
PLEASE HELP !!
Subject: May help…
I dug this out from something I did recently which may help…
Dim body As NotesMIMEEntity
Dim bodyChild As NotesMIMEEntity
Dim header As NotesMIMEHeader
Dim stream As NotesStream
Dim docMemo As NotesDocument
Set docMemo = dbMailBox.Createdocument() 'creating mail in the mail box
session.ConvertMIME = False ’ Do not convert MIME to rich text
Set stream = session.CreateStream
Set body = docMemo.CreateMIMEEntity
Set bodyChild = body.Createchildentity()
Set header = bodyChild.createHeader(“Content-Type”)
Call header.setHeaderVal(“text/htm”)
Call stream.Open(“c:\temp\ReportName.html”) 'Just importing the body of the email here in html format, also attaching it as a file later
Call bodyChild.SetContentFromText(stream, “text/HTML;charset=UTF-8”, ENC_IDENTITY_7BIT)
Attachment 1
Set bodyChild = body.Createchildentity()
Set header = bodyChild.createHeader(“Content-Type”)
Call header.setHeaderVal(“multipart/mixed”)
Set header = bodyChild.createHeader(“Content-Disposition”)
Call header.setHeaderVal(“attachment; filename=fileName.csv”)
Set header = bodyChild.createHeader(“Content-ID”)
Call header.setHeaderVal(“fileName.csv”)
Set stream = session.CreateStream
Call stream.Open(“c:\temp\fileName.csv”)
Call bodyChild.SetContentFromBytes(stream, “application/csv”, ENC_IDENTITY_BINARY)
Attachment 2
Set bodyChild = body.Createchildentity()
Set header = bodyChild.createHeader(“Content-Type”)
Call header.setHeaderVal(“multipart/mixed”)
Set header = bodyChild.createHeader(“Content-Disposition”)
Call header.setHeaderVal(“attachment; filename=ReportName.html”)
Set header = bodyChild.createHeader(“Content-ID”)
Call header.setHeaderVal(“ReportName.html”)
Set stream = session.CreateStream
Call stream.Open(“c:\temp\ReportName.html”)
Call bodyChild.SetContentFromBytes(stream, “text/HTML”, ENC_IDENTITY_BINARY)
Call docMemo.Save(True, False)
Subject: Multiple attachments removed while saving MIME format notes document
Thanks Mike for your response.
But I checked the MIME parts and all other parts are working perfectly fine for ex : inline attachments, text etc.
But When I save notes document with the picked MIME content , it only saves one attachment (i.e. $ file ) and removed other attachments.
Not sure why it is happening.
Subject: attachhing from drive whereas I would like to have it from another mail
Thanks D porter for piece of code and suggestions.
But again in your code you are uploading attachments from c drive whereas I already have one notes email (with multiple attachments) and I wish to convert that notes mail into file.
Subject: This is totally off the wall …
I dunno how your MIME email was constructed, but y’might check whether the number of the MIMEPart is different on each entity.
I once wrote some code creating MIME emails, and it seemed to work swimmingly in Notes.
Then when it went to Outlook, Outlook went haywire, splitting up MIME parts, and unable to access MIME parts all over.
I traced it to breaking the email into MIME parts at points where “Outlook didn’t like it”, and naming them all the same thing.