Добавление ссылки на проект в библиотеку объектов Microsoft Outlook X
Затем в форме, модуле, классе или чем-то еще ... Я выбрал событие button_click.
Private Sub Command1_Click()
Dim objOutlook As Outlook.Application
Dim objMail As MailItem
Dim strToAddress As String
Dim strSubject As String
Dim strBody As String
Set objOutlook = New Outlook.Application
Set objMail = Outlook.CreateItem(olMailItem)
strToAddress = "me@mydomain.com"
strSubject = "VB6 test email"
strBody = "This is a test email sent from VB6"
With objMail
.To = strToAddress
.Subject = strSubject
.BodyFormat = olFormatPlain
.Body = strBody
End With
MsgBox "outlook security will now complain as I try to resolve your email addresses against your address book"
objMail.Recipients.ResolveAll
objMail.Save
Set objMail = Nothing
Set objOutlook = Nothing
MsgBox "look in your drafts folder for the new email"
'Thank you, I'm here all week, try the Veal. Good night.
End Sub