|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Looping items for email BCC
I have a storefront order notification routine, and it includes a CDO email function to send an email alert to my customers.
I want to add each manufacturer email (ManufName) in the BCC section, so they get notified of the order as well. Problem is, each Order number (OrderID) can have several purchased items associated with it (i.e. a customer buys several different products from different manufacturers), so I have to do a DO UNTIL loop. I am stuck however.. Again, the common identifying column is the OrderID. If there are several different files in a purchase, there will be several rows with the same OrderID. Here is what I have made so far. Somehow this has to be turned into an array, so it can be put in the BCC field? Thanks for any help offered! Code:
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "SELECT * FROM qOrders WHERE OrderID = "&OrderIDFG&";", cnDZ, adOpenStatic, adLockOptimistic
CurrentItem = rs("OrderID")
Do Until CurrentItem <> rs("OrderID")
rs.MoveNext
If rs.EOF Then Exit Do
Loop
rs.MovePrevious
Response.Write"" & rs("ManufName") & ""
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
This is what the end result should look like, if the order had products from 3 different manufacturers: Code:
'Begin Send an Email to Customer and Store admin to notify them of their purchase and download instructions
Set cMailer = Server.CreateObject("CDO.Message")
cMailer.From = admin@mystore.com
cMailer.To = Payer_Email
cMailer.Bcc = bob@manufacturer1.com, sue@manufacturer5.com, bill@manufacturer15.com
|
|
#2
|
|||
|
|||
|
Does the response.write show you the right data? If so you can simply add the field to a string in each iteration through your loop.
Response.Write"" & rs("ManufName") & "" strStuff = strStuff & rs("ManufName") & ","
__________________
====== Doug G ====== I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain |
|
#3
|
|||
|
|||
|
Ok, that sounds like it would work.
20,000 dollar question: If someone buys, lets say, 4 products from one manufacturer in one order, I would only like to have the system send one email to that manufacturer. Any idea how to easily accomplish that? Thanks Quote:
|
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Looping items for email BCC |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|