VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Send Email whith VB6, very easy.

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)

Rate Send Email whith VB6, very easy.



    '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


Download this snippet    Add to My Saved Code

Send Email whith VB6, very easy. Comments

No comments have been posted about Send Email whith VB6, very easy.. Why not be the first to post a comment about Send Email whith VB6, very easy..

Post your comment

Subject:
Message:
0/1000 characters