|
-
Jul 10th, 2001, 05:20 AM
#1
Thread Starter
Junior Member
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.
-
Jul 10th, 2001, 09:10 AM
#2
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
-
Jul 10th, 2001, 07:18 PM
#3
Registered User
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.
-
Jul 11th, 2001, 03:25 AM
#4
PowerPoster
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|