Headers and MimeEmailMBS

Hi all
I need an header.source string using MimeEmailMBS like using emailheaders.source in Xojo standard

How can I achieve it?

Thanks

at MimeEmailMBS, you can get MimeHeaderMBS via header property.

it has most properties directly and via FieldByName(name as string) you can get others.

Thanks for you reply, but I am dealing with emails wth lots of unusual headers, so it would be more comfortable (and I assume faster) getting the string via a single command.

Thanls

I could add a method there.

get headers as one big string?
Or an array of strings?
Or a dictionary?

Very kind of you.

For me a string would be much more than enough

Thanks

I think you can simply get that by looping over array of fields:

[code]dim header as MimeHeaderMBS

dim fields() as MimeFieldMBS = header.Fields
dim strings() as string

for each field as MimeFieldMBS in fields
strings.Append field.Name+": "+field.Value
next

MsgBox Join(strings, EndOfLine)[/code]

Same names may be there several times!

Thanks
It (obviously) works.

I have now another problem with MimeEmailMBS, when its inside it another email as an .eml file.
Its seen by the class as just one email with many inlines but I think it is not like that, and the attachment I am interested in had the data property empty.
but for that I guess I have to send a small attachment.

Thanks

Well, you can always send me a test project and a test email file to look at.

Thanks i will in the afternoon

Thanks again

Antonio

For the text emails split in several chunks, you can assemble the whole text:

[code]dim f as FolderItem = GetFolderItem(“prova.eml”)
dim tx as TextInputStream = tx.open(f)
dim buf as string = tx.ReadAll
dim m as new MimeEmailMBS(buf)

dim pt as string = m.PlainText

dim Inlines() as MimeAttachmentMBS = m.Inlines
for each a as MimeAttachmentMBS in inlines
if a.ContentType.left(10) = “text/plain” then
pt = pt + a.body.StringValue
end if
next

MsgBox pt[/code]

This is a simple sample code without error checking.