Results 1 to 4 of 4

Thread: send e-mails from vb6

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2001
    Posts
    27

    Cool send e-mails from vb6

    hello to all,
    can any body help me about how can i send e-mail to any body from my vb program.

  2. #2
    jim mcnamara
    Guest
    Use the MS Mapi control. This code sends readme.txt to users listed in the file mailrecipients.txt

    Code:
    Sub mailIt()
        Dim msgtext As String
        Dim i, tmp(10)
        
        Dim index As Variant
        readReadMe msgtext
        getMailRecipients tmp(), index
        With frmMain
           .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
    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

  3. #3
    Registered User Nucleus's Avatar
    Join Date
    Apr 2001
    Location
    So that's what you are up to ;)
    Posts
    2,530
    If you want the app to be independent of outlook/exchange then use winsock and SMTP. Goto www.planetsourcecode.com, there are a few good examples in there.

  4. #4
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    You can also look at the pop3 and SMTP articles on www.vbsquare.com and mailchecker sample application at www.vbip.com

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