Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
Send a Digitally Signed Email
This example source code sends a digitally signed email. It automatically finds and selects the digital certificate based on the From email address. This is the quickest and easiest way to send a digitally signed email. This program should work if you already have Outlook configured and are able to send signed mail from Outlook.
' VB example program to send a digitally signed email.
Private Sub Command1_Click()
' Create the mailman object for sending mail.
Dim mailman As ChilkatMailMan2
Set mailman = New ChilkatMailMan2
' Pass any string to begin the 30-day trial.
mailman.UnlockComponent "UnlockCode"
' Set our SMTP server to be used for sending signed mail.
mailman.SmtpHost = "smtp.earthlink.net"
' Only set username/password if your SMTP server requires a logon.
'mailman.SmtpUsername = "your_username"
'mailman.SmtpPassword = "your_password"
' Only set the login domain if your SMTP server uses integrated Windows authorization
' AND it is part of a domain.
'mailman.SmtpLoginDomain = "your_domain"
' Create the mail object.
Dim email As ChilkatEmail2
Set email = New ChilkatEmail2
email.AddTo "Email Expert", "support@chilkatsoft.com"
email.Subject = "This is the subject"
email.Body = "This is the body"
email.From = "matt@chilkatsoft.com"
' To send encrypted and/or signed emails, just set either or both of these flags.
' Chilkat Mail will automatically find the certificates based on the From / To
' email addresses. For signing, the certificate matching the From email address
' is used. For encryption, the certificate matching the To email address is used.
' When sending a signed email, the private key is used, so the private key
' associated with the chosen certificate must be installed on the system.
' In general, if you have Outlook setup correctly and you are able to send
' signed emails using Outlook, this should work. Sending a signed email is
' nothing more than setting the SendSigned property to 1.
email.SendSigned = 1
'email.SendEncrypted = 1
' Send mail. Returns 1 for success, 0 for failure
Dim success As Long
success = mailman.SendEmail(email)
If (success = 0) Then
MsgBox mailman.LastErrorText
Else
MsgBox "Digitally Signed Email Sent!"
End If
End Sub
|
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2008 Chilkat Software, Inc. All Rights Reserved.