Results 1 to 3 of 3

Thread: Outlook Express and Visual Basic

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2002
    Posts
    95

    Outlook Express and Visual Basic

    Is there a way to use Outlook Express via Visual Basic?
    or is it just Outlook full version that can be used via Visual Basic?



    If yes, then how?



    Thanks.

  2. #2
    jim mcnamara
    Guest
    If you use MAPI controls -MAPIMessages, MAPISession, they allow you to connect to the default mail client on the PC. It doesn't matter as long as the client is MAPI-Compliant.

    Is this what you mean?

  3. #3
    jim mcnamara
    Guest
    This code sends readme.txt to the usernames in mailrecipients.txt, needs to control MAPIMEssesges1, MAPISession1.

    Code:
    Sub readReadMe(s As String)
        Dim i
        i = FreeFile
        Open "\fiche\contain\readme.txt" For Input As i
        s = Input(LOF(i), i)
        Close i
    End Sub
    
    Private Sub killFile(n)
           Kill n
    End Sub
    Sub mailIt()
        Dim msgtext As String
        Dim i, tmp(10)
        
        Dim index As Variant
        readReadMe msgtext
        getMailRecipients tmp(), index
        With frmMain
           .MapiSess.DownLoadMail = False
           .MapiSess.Action = mapSignOn
           .List1.AddItem "Logging on to Mail Server"
           .List1.ListIndex = .List1.ListCount - 1
           .MapiMess.SessionID = .MapiSess.SessionID
           For i = 1 To index
                .MapiMess.Action = mapCompose
                .MapiMess.MsgNoteText = msgtext
                .MapiMess.RecipAddress = tmp(i)
                .MapiMess.Action = mapSend
           Next
           .List1.AddItem "Completed mail message"
           .MapiSess.Action = mapSignOff
           .List1.AddItem "Mail sent."
           .List1.ListIndex = .List1.ListCount - 1
        End With
        MsgBox "Acknowledgements mailed", vbOKOnly
    End Sub
    
    Sub getMailRecipients(s(), m)
        Dim i, j, x
        Dim a$, tmp
        i = FreeFile
        
        Open "\fiche\mail_recipients.txt" For Input As i
        x = 0
        Do While Not EOF(i)
           Line Input #i, a$
           x = x + 1
           s(x) = a$
           
        Loop
        m = x
        If m = 0 Then
           GoTo bad_inputfile
        End If
        Exit Sub
    bad_inputfile:
        MsgBox "Cannot send mail. MAIL_RECPIENTS.TXT has no adressees.", vbOKOnly
    End Sub

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