Hello,
I have been attempting to use the code below to send multiple emails and it does not work. I have searched this site and there is alot of info about emails from VB but I am not clear on sending multiple emails at one time. I have no problem hardcoding multiple email addresses and sending them. I am using VB6 (and Access2000) and have a table and a field within it called email, I wish the code to view all of the email names (RecipDisplayName) within the email field and place them in the "To:" box (separated by a colon). As you can see below, I have tried the Do-Loop method. I would greatley appreciate any help.
sPath = App.Path & "\db1.mdb"
Set daoDB36 = DBEngine(0).OpenDatabase(sPath)
Set rs = daoDB36.OpenRecordset("Select email from email"
Set Data1.Recordset = rs
Dim h As Integer
'MAPI constants from CONSTANT.TXT file:
Const SESSION_SIGNON = 1
Const MESSAGE_COMPOSE = 6
Const ATTACHTYPE_DATA = 0
Const RECIPTYPE_TO = 1
Const RECIPTYPE_CC = 2
Const MESSAGE_RESOLVENAME = 13
Const MESSAGE_SEND = 3
Const SESSION_SIGNOFF = 2
MAPISession1.Action = SESSION_SIGNON
MAPIMessages1.SessionID = Form1.MAPISession1.SessionID
MAPIMessages1.Action = MESSAGE_COMPOSE
MAPIMessages1.MsgSubject = Text2
MAPIMessages1.MsgNoteText = Text1
MAPIMessages1.AttachmentPosition = 0
MAPIMessages1.AttachmentType = ATTACHTYPE_DATA
h = 0
Do While Not rs.EOF
h = h + 1
MAPIMessages1.RecipIndex = h
MAPIMessages1.RecipType = RECIPTYPE_TO
MAPIMessages1.RecipDisplayName = rs!email
rs.MoveNext
Loop
MAPIMessages1.Action = MESSAGE_RESOLVENAME
MAPIMessages1.Action = MESSAGE_SEND
MAPISession1.Action = SESSION_SIGNOFF
Thanks
I have been attempting to use the code below to send multiple emails and it does not work. I have searched this site and there is alot of info about emails from VB but I am not clear on sending multiple emails at one time. I have no problem hardcoding multiple email addresses and sending them. I am using VB6 (and Access2000) and have a table and a field within it called email, I wish the code to view all of the email names (RecipDisplayName) within the email field and place them in the "To:" box (separated by a colon). As you can see below, I have tried the Do-Loop method. I would greatley appreciate any help.
sPath = App.Path & "\db1.mdb"
Set daoDB36 = DBEngine(0).OpenDatabase(sPath)
Set rs = daoDB36.OpenRecordset("Select email from email"

Set Data1.Recordset = rs
Dim h As Integer
'MAPI constants from CONSTANT.TXT file:
Const SESSION_SIGNON = 1
Const MESSAGE_COMPOSE = 6
Const ATTACHTYPE_DATA = 0
Const RECIPTYPE_TO = 1
Const RECIPTYPE_CC = 2
Const MESSAGE_RESOLVENAME = 13
Const MESSAGE_SEND = 3
Const SESSION_SIGNOFF = 2
MAPISession1.Action = SESSION_SIGNON
MAPIMessages1.SessionID = Form1.MAPISession1.SessionID
MAPIMessages1.Action = MESSAGE_COMPOSE
MAPIMessages1.MsgSubject = Text2
MAPIMessages1.MsgNoteText = Text1
MAPIMessages1.AttachmentPosition = 0
MAPIMessages1.AttachmentType = ATTACHTYPE_DATA
h = 0
Do While Not rs.EOF
h = h + 1
MAPIMessages1.RecipIndex = h
MAPIMessages1.RecipType = RECIPTYPE_TO
MAPIMessages1.RecipDisplayName = rs!email
rs.MoveNext
Loop
MAPIMessages1.Action = MESSAGE_RESOLVENAME
MAPIMessages1.Action = MESSAGE_SEND
MAPISession1.Action = SESSION_SIGNOFF
Thanks