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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Multiple Recipients Dynamically on JMail

Status
Not open for further replies.

rvancleef

Programmer
Apr 8, 2003
34
0
0
US
I need to send an email to multiple recipients using the JMail component. The list varies based on numerous business rules, so it is more effective to dynamically build this list of recipients and store them in one variable.

If X Then
vTo = getemail(staffid1)&", "&getemail(staffid2)&", "&getmangeremail(staffid1)
Else
vTo = getemail(staffid1)&", "&getemail(staffid2)
End If


You get the idea...

With CDONTS I have achevied this by placing a comma delimited list of recipients in a string variable and then assigning it with:

cdontsobj.to = vTo

However on this assignment I am only permitted to use JMail. The closest syntax I could come up with for JMail is:
jmailobj.recipient (vTo)

However, this causes an error reaching the servers. If I hard code one email address the error goes away and the message is sent so I am sure this is the issue.

Any ideas how can I place my list of recipients in JMAIL?

Thanks!
 
With Jmail create loop adding recipients, just amend this example to the way you have your recipients, its not clear from your code, in this example its taken from a db

do while not rs.eof
jmailobj.AddRecipient rs("email")
rs.movenext
loop

 
Hmmmm.

Unfortunately the list of Recipients is not a query that I can pull from a database, it is rather dependant on business rules.

But maybe I can loop through the comma delimited elements in the vTo variable. Will give it a try...
 
if its a comma delimited string then it justs needs a slight amendment...

arrayEmail=split(vTo,",")

for count=0 to ubound(arrEmail)
jmailobj.AddRecipient arrayEmail(count)
next

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top