by David SERROR (2 Submissions)
Category: Internet/HTML
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 11th April 2002
Date Added: Mon 8th February 2021
Rating:
(1 Votes)
Send Email whith VB6, very easy.
API Declarations
Microsoft Outlook 9.0 Object Library
Microsoft Data Formatting Object Library 6.0(SP4)
'programmation de l'envoi d'un e-mail
Dim objOutlook As Outlook.Application
Dim objSession As Outlook.NameSpace
Dim objMessage As Outlook.MailItem 'Object
Dim objRecipient As Object
Dim fichier_joint As String
Dim adresse As String
fichier_joint = "c:\test.txt"
adresse = "[email protected]"
Set objOutlook = CreateObject("Outlook.Application")
Set objSession = objOutlook.GetNamespace("MAPI")
Set objMessage = objOutlook.CreateItem(olMailItem)
Set objRecipient = objSession.CreateRecipient(adresse)
objSession.Logon
objMessage.Recipients.Add (objRecipient)
objMessage.Subject = "Test"
objMessage.Body = "This is a Test"
objMessage.Attachments.Add (fichier_joint)
objMessage.Send
' objMessage.Display
MsgBox "Message sent successfully!"
Set objRecipient = Nothing
objSession.Logoff
End Sub