HeaderItem.SubValue Method


Gets the value of the sub-key of the header.

[Visual Basic 6.0]
Public Function SubValue( _
    SubKey As String _
) As String
[Visual C++]
public: HRESULT SubValue(
    BSTR subKey,
    BSTR* pVal
);

Parameters

SubKey
The sub-key name.

Return Value

The value of the sub-key.

Example

[Visual Basic 6.0] To get the full samples of EAGetMail, please refer to Samples section.

[Visual Basic 6.0]
Public Sub ParseHeaders()
    Dim oMail As New EAGetMailObjLib.Mail
    oMail.LicenseCode = "TryIt"
    oMail.LoadFile "c:\test.eml", True
    
    Dim oHeaders As EAGetMailObjLib.HeaderCollection
    Set oHeaders = oMail.Headers
    Dim i, nCount As Integer
    nCount = oHeaders.Count
    For i = 0 To nCount - 1
        Dim oHeader As EAGetMailObjLib.HeaderItem
        Set oHeader = oHeaders.Item(i)
        If StrComp(oHeader.HeaderKey, "Content-Type", vbTextCompare) = 0 Then
            'if the header is: 
            'Content-Type: multipart/alternative;
            '   boundary = "=_MAILER_ATTACH_BOUNDARY1_200675313102924710512"
            ' then oHeader.SubValue("boundary") returns =_MAILER_ATTACH_BOUNDARY1_200675313102924710512        
            MsgBox oHeader.SubValue("boundary")
        End If
    Next
End Sub

See Also

Mail.Headers Property

Online Tutorials

Parse Email in VB6
Parse Email in Delphi
Parse Email in VC++