VBScript Requires Chilkat v11.0.0+
VBScript
Set a MIME header on one attachment
See more Email Object Examples
Add a file using the content type required by the receiving application. Set Content-Description on the newly added MIME part and read it back from that part. The message-level headers have a separate collection.
Chilkat VBScript Downloads
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)
success = 0
' Assumes Chilkat is unlocked. See Global Unlock Sample.
set email = CreateObject("Chilkat.Email")
email.From = "Workshop team <events@example.com>"
success = email.AddTo("Alex Rivera","alex@example.net")
If (success <> 1) Then
outFile.WriteLine(email.LastErrorText)
WScript.Quit
End If
email.Subject = "Workshop registration"
email.Body = "Attached is the requested data file."
success = email.AddFileAttachment2("sample.hpm","application/x-hprimnet")
If (success <> 1) Then
outFile.WriteLine(email.LastErrorText)
WScript.Quit
End If
index = email.NumAttachments - 1
email.AddAttachmentHeader index,"Content-Description","HPM/3.0"
outFile.WriteLine(email.GetAttachmentHeader(index,"Content-Description"))
success = email.SaveEml("described-attachment.eml")
If (success <> 1) Then
outFile.WriteLine(email.LastErrorText)
WScript.Quit
End If
outFile.WriteLine("Saved described-attachment.eml.")
outFile.Close