Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple receipients in VB Mail

Status
Not open for further replies.

2good2btru

Programmer
May 1, 2001
17
AE
I am using the MAPI controls for sending mail through code.... Problem is I want to send these mails to multiple clients.... I tried seperating the client address by a ';',
It didnt work, then i tried enclosing the address within a <>... eg..<add1@aa.com>;<add2@aa.com>, It send the mail to add1@aa.com, but not to add2@aa.com
What am i doing wrong....
What can be done so that i can jus mail using a list of address and not program it to search for the second address and send it in the CC list or something .....
 
strSendto = &quot;person1@test.com; person2@test.com&quot;

need to have a &quot;; &quot; between each address.
 
This is how I did it
I had all the addresses in a customer Access MDB that I set as the recordsource of ADODCEmail. Sends in blocks of 50 at a time.
If you use
RecipType=1 you get single emails
RecipType=2 you get a normal CC
RecipType=3 you get blind CCs

Sub SendAllEmail(Recipients As Integer)
Dim RecipientAddress As String
On Error GoTo SAEError
MAPISession1.DownLoadMail = False
MAPISession1.SignOn
MAPIMessages1.SessionID = MAPISession1.SessionID
BlinkDot True
If Recipients < 51 Then AdodcEmail.Recordset.MoveFirst
MAPIMessages1.Compose
MAPIMessages1.MsgSubject = EmailSubjectBox
MAPIMessages1.MsgNoteText = EmailMessageBox
For a = 1 To Recipients
MAPIMessages1.RecipIndex = a - 1
X = AdodcEmail.Recordset.Fields(&quot;FirstName&quot;) & &quot; &quot; & AdodcEmail.Recordset.Fields(&quot;LastName&quot;)
MAPIMessages1.RecipDisplayName = X
MAPIMessages1.RecipAddress = AdodcEmail.Recordset.Fields(&quot;EmailURL&quot;)
MAPIMessages1.RecipType = 3 'blind carbon copy
AdodcEmail.Recordset.MoveNext
Next
MAPIMessages1.Send False 'send all in one go
EndSAE:
MailHelpLabel.Caption = a - 1 & &quot; Customers have been sent an Email.&quot;
If a - 1 <> Recipients Then MailHelpLabel.Caption = MailHelpLabel.Caption & &quot; Not all of the Emails were sent. Check the [SentItems] and [Outbox].&quot;
On Error GoTo 0
Exit Sub

SAEError:
Beep
MsgBox &quot;Fault in sending Email&quot;, 16, &quot;WARNING&quot;
BlinkDot False
If MAPISession1.SessionID > 0 Then MAPISession1.SignOff
Resume EndSAE

End Sub
 
I tried ur solution ted, but i am getting an error... &quot;No Transport service was provided for the recipients&quot;
Though the same is working fine for single Recipient...
 
I tried ur solution ted, but i am getting an error... No Transport service was provided for the recipients
Though the same is working fine for single Recipient...
 
Works fine for me.
Never heard of a 'transport service'!
I didnt know you could send emails by bus or train.
Maybe your email service doe not support multiple mailing this way?
Are you using a regular POP3 ISP or a hotmail or yahoo mail thingy?
 
u know the best part......
if i do it like ..
.RecipAddress = &quot;person1@add1.com; person2@add2.com&quot;
and the rest of the params and then say Send True

The mail thing opens up rite!, then i try clicking on send , it doesnt send it, tries to search for the whole string in the address book, now if i jus type something in the 'To Rcipient' and delete it (jus to fire the event that 'To' field was modified)... and then send the mail it is send successfully.... so the point is it is not sending it directly thru the program.... dunno y.....
I am using a regular mail service...., it supports multiple mailing i think, i mean it doesnt have any prob if i compose a mail manually and add multiple ids to the To Recipient List....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top