|Posted by:||Remy Lebeau \(Indy Team\) (firstname.lastname@example.org)|
|Date:||Mon, 9 Oct 2006|
"antonioVS" <aferra…@uniplan.it> wrote in message
> Dim MP As Indy.Sockets.Text = xMsg.MessageParts(1)
The MessageParts collection is 0-indexed, not 1-indexed. You are grabbing
the second part, not the first part. Is that what you really want?
You are also assuming the part is always a text part without actually
verifying that. If it is not a text part, then the code will fail.
> For x As Integer = 1 To xMsg.MessageParts.Count - 1
Again, you are skipping the first part in the collection.
> att = CType(xMsg.MessageParts.Items(x),
You don't need to use CType to verify the type of the part. You can use its
PartType property instead:
IsAtt = (xMsg.MessageParts.Items(x) == mptAttachment)
> Dim ct As String = xMsg.MessageParts.Items(x).ContentType
> If isAtt Then 'ct = "application/octet-stream" Then
Why are you discarding the actual ContentType when the part is an
attachment? Attachments can have specialize ContentTypes of their own.
> I put the attachment in stream, but I'm not be able to view or save
> the file in an asp.net page.
Why not? Please be more specific. What EXACTLY are you doing with the
stream after you save the message to it?
Indy.Sockets.TIdNetMemoryStream posted by antonioVS on Mon, 9 Oct 2006