Visual Basic Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

VB Examples

Bounced Mail
Bz2
Character Encoding
CSV
Digital Certificates
Digital Signatures
Email
FTP
HTML-to-XML
HTTP
IMAP
Encryption
MHT / HTML Email
POP3
RSA
S/MIME
SFTP
SMTP
Socket
Spider
SSH
SSH Key
SSH Tunnel
String
Tar
Unicode
Upload
XML
XMP
Zip Compression

More Examples...
Email Object
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA


VB Strings
VB Byte Array

Unreleased...
Bzip2
LZW
Icon

 

 

 

 

 

 

 

Customize Message-ID when Sending Email

Download Chilkat Email ActiveX

This example discusses the Message-ID header field for email and how to customize it for your outgoing email.

' The Message-ID email header field is treated somewhat specially by the
' Chilkat email component.
' Many SMTP servers will consider emails as duplicates if the Message-ID is identical,
' even if the other parts (subject, body, etc.) are different.  These SMTP servers
' may silently drop duplicates.
' The Chilkat mailman's SendEmail method automatically replaces the Message-ID header
' field in the outgoing email with a unique value.  This behavior can be turned off
' by setting the ChilkatMailMan2.AutoGenMessageId property = 0.
' Your program may set a custom Message-ID by calling the ChilkatEmail2.AddHeaderField method.
Private Sub Command7_Click()

    ' Create an instance of the mailman for the purpose of unlocking.
    Dim mailman As New ChilkatMailMan2
    mailman.UnlockComponent "Anything for 30-day trial"
    
    ' Turn off the auto-generate message-id feature.
    mailman.AutoGenMessageId = 0
    
    ' Create a new email object...
    Dim email As New ChilkatEmail2
    
    email.Subject = "This is a test"
    email.Body = "This is the mail body"
    email.AddTo "Chilkat Support", "support@chilkatsoft.com"
    email.From = "Chilkat Sales <sales@chilkatsoft.com>"
    
    ' Set our own Message-ID
    ' The AddHeaderField method will replace a header field if it already exists.
    email.AddHeaderField "Message-ID", "4387ty6wer7g8745e8rtg"
    
    ' We can send the email like this:
    mailman.SmtpHost = "smtp.comcast.net"
    success = mailman.SendEmail(email)
    If (success = 0) Then
        MsgBox mailman.LastErrorText
    Else
        MsgBox "Mail Sent!"
    End If

End Sub

 

Need a specific example? Send a request to support@chilkatsoft.com

© 2000-2008 Chilkat Software, Inc. All Rights Reserved.