Results 1 to 2 of 2

Thread: bets way to send email from vb6

  1. #1

    Thread Starter
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    This just uses the Active Messaging: Olemsg32.dll
    Code:
    Private Sub EmailMessage()
     
    
    
      Dim oSession As MAPI.Session
      Dim oMessage As MAPI.message
      Dim oRecipient As MAPI.Recipient
    
      
      Set oSession = CreateObject("MAPI.Session")
    
        oSession.Logon 'this will promt for a profile. This can be avoided by including the profile name
        
          Set oMessage = oSession.Outbox.Messages.Add
          With oMessage
            .Subject = "email from " & App.Title
            .Text = "This is a test message"
            .Attachments.Add "c:\yourFile.txt"
            
            Set oRecipient = oMessage.Recipients.Add
            oRecipient.Name = "someone@somewhere"
            oRecipient.Resolve
            
            
            
            .Update
           
           
            .Send
        End With
        oSession.Logoff
        Set oSession = Nothing
        Set oMessage = Nothing
        Set oRecipient = Nothing
       
    
        
      End Sub
    [Edited by Mark Sreeves on 05-12-2000 at 12:39 PM]
    Mark
    -------------------

  2. #2

    Thread Starter
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    WILL anyone using this code please remove my email address from it as I keep getting "Test Messages"!


    (I included my email add in oRecipient.Name = ...)


    Mark
    -------------------

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width