Results 1 to 2 of 2


  1. #1
    Join Date
    Dec 1969

    Default CDONTS, ARRAYS and DB

    Hi - I have a web app. that allows the webmaster to send newsletter emails to all those on their email list. They can add a &#039;subject line&#039;, some introductory text and can choose one or more news stories to include in the email newsletters.<BR><BR>The initial page displays all the news stories in the db that the webmaster can choose from - these are represented in a form via checkboxes (all same name, with value = ID of newsletter). Prior to the page being sent, the wmaster can preview the page. <BR><BR>I&#039;m using SPLIT to split up the comma delimited IDs, then sticking the IDs in an array. There is then a FOR NEXT loop that iterates through the IDs and retireves the news articles based on the IDs.<BR><BR>This all works great - the preview page shows the subject line, the introductory text then all the news stories that the wmaster wants to send out with the newsletter email.<BR><BR>My question (in here somewhere!), is how to handle the above once the wmaster clicks &#039;send&#039;. I&#039;m aware that I can&#039;t do any conditional processing WITHIN the CDONTS email, so how do I set the code up so that by the time the CDONTS is called, all the information is ready to be passed to it. I&#039;m unsure how to handle this given that the number of news stories that will be displayed in the email can and will vary each time the newsletter is sent out (once a month or so).<BR><BR>From the preview page I use hidden form fields to pass the &#039;subject line&#039; and the &#039;introductory text&#039; to the SEND page. I can use the same approach to send the news stories IDs to the SEND page too, but once there what can I do? can I use an array within the &#039;body&#039; of the CDONTS - to iterate through the news stories? <BR><BR>Massive thanks in advance for anyone who reads the above, and even bigger thanks for anyone who can suggest a &#039;fix&#039;....

  2. #2
    Join Date
    Dec 1969

    Default Wow. I thought I was the only...

    .. person who wrote novels when posting questions.<BR><BR>But, think about how you are building the body of the message. Hopefully you are first building a string and THEN assigning that string to the object&#039;s .Body property.<BR><BR>Your code should look something like this:<BR>Dim strBody<BR> strBody = "The cat ate the dog." & vbCRLF<BR> strBody = strBody & "The mouse ate the cat." & vbCRLF<BR> strBody = strBody & "The mouse watched porno." & vbCRLF<BR> CDOobj.Body = strBody<BR><BR>Now, you can easily put conditions in:<BR>Dim strBody<BR> strBody = ""<BR> If Request.Form("catAteDog") = "yes" Then<BR> strBody = strBody & "The cat ate the dog." & vbCRLF<BR> End If<BR><BR> If Request.Form("mouseAteCat") = "yes" Then<BR> strBody = strBody & "The mouse ate the cat." & vbCRLF<BR> End If<BR><BR> If Request.Form("mouseStrokeIt") = "yes" Then<BR> strBody = strBody & "The mouse watched porno." & vbCRLF<BR> End If<BR><BR>-Doug

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts