Sample code for 30+ languages & platforms
Visual Basic 6.0 Requires Chilkat v11.0.0+

Update the Date of a saved draft

See more Email Object Examples

New Email objects already have a Date field. When reusing a saved draft, set its Date from the system clock immediately before submission. Save a separate copy so the original date is still available.

Chilkat Visual Basic 6.0 Downloads

Visual Basic 6.0
Dim success As Long
success = 0

'  Assumes Chilkat is unlocked. See Global Unlock Sample.

Dim email As New ChilkatEmail
success = email.LoadEml("message.eml")
If (success <> 1) Then
    Debug.Print email.LastErrorText
    Exit Sub
End If

Debug.Print "Previous Date: " & email.EmailDateStr
Dim now As New CkDateTime
success = now.SetFromCurrentSystemTime()
If (success <> 1) Then
    Debug.Print "Failed: now.SetFromCurrentSystemTime."
    Exit Sub
End If

success = email.SetDt(now)
If (success <> 1) Then
    Debug.Print email.LastErrorText
    Exit Sub
End If

Debug.Print "Updated Date: " & email.EmailDateStr

success = email.SaveEml("updated-draft.eml")
If (success <> 1) Then
    Debug.Print email.LastErrorText
    Exit Sub
End If

Debug.Print "Saved updated-draft.eml."