CDONTS and multiple variables

Results 1 to 4 of 4

Thread: CDONTS and multiple variables

  1. #1
    JWeber Guest

    Default CDONTS and multiple variables

    I am trying to email the data from an insert form, using CDONTS. The script works if just one field is used, but where I need multiple variables it fails: I need multiple fields passed in the body of the email, and I need the email BCC&#039d to multiple recipients.<BR><BR>THis is my code:<BR><BR>&#060;% if (cStr(Request("Submit")) &#060;&#062; "") Then<BR>Dim objCDO<BR>Set objCDO = Server.CreateObject("CDONTS.NewMail")<BR>objCDO.Fr om = ""<BR>objCDO.To = ""<BR><BR>objCDO.Subject = "Order Form"<BR>objCDO.Body = "Contact Name" & Request.Form("ShipName") objCDO.Send()<BR>Set objCDO = Nothing<BR>Response.Redirect("orderform2.asp")<BR> End If<BR>%&#062;<BR><BR>Thanks for your help!

  2. #2
    Markkk Guest

    Default RE: CDONTS and multiple variables

    Try something like:<BR><BR>&#060;% if (cStr(Request("Submit")) &#060;&#062; "") Then<BR>Dim objCDO<BR><BR>Set objCDO = Server.CreateObject("CDONTS.NewMail")<BR>objCDO.Fr om = ""<BR>objCDO.To = ""<BR>objCDO.Subject = "Order Form"<BR><BR>Dim strBody<BR>strBody = ""<BR>strBody = strBody & "Contact Name: " & Request.Form("ShipName")<BR>strBody = strBody & VbCrLf<BR>strBody = strBody & "Contact Phone: " & Request.Form("PhoneNumber")<BR>strBody = strBody & VbCrLf<BR>strBody = strBody & "Contact Email: " & Request.Form("Email")<BR>&#039---where VbCrLf is a VB Constant for Carraige Return & Line Feed (identified in file)<BR><BR>objCDO.Body = strBody<BR><BR>objCDO.BCC = Request.Form("BCC1") & "," & Request.Form("BCC2") &#039---etc.<BR><BR>objCDO.Send<BR>Set objCDO = Nothing<BR>Response.Redirect("orderform2.asp")<BR> End If<BR>%&#062;<BR><BR><BR>Notice how each line of the body is written in a seperate script line. This will allow you to better format (layout) your email body (if fixed font text is used by email client).<BR><BR>I hope this helps!!!<BR><BR>

  3. #3
    JWeber Guest

    Default RE: CDONTS and multiple variables

    The form values worked beautifully! Thanks a million!<BR><BR>If you&#039re still feeling charitable, I couldnt get the BCC part to work. My BCC values are hard coded. I tried the following variations, but none of them worked.<BR><BR>objCDO.BCC = "" & "," & "" <BR><BR>objCDO.BCC = "," <BR><BR>Thanks again - its incredible when it works!

  4. #4
    Join Date
    Dec 1969

    Default RE: CDONTS and multiple variables

    Hi JWeber,<BR><BR>See if you can find your problem with this piece of info. *hint* check the last line ;o)<BR><BR>&#060;snip&#062;<BR>Bcc Property (CDONTS NewMail Object) <BR>The Bcc property adds to the list of blind copy (Bcc) recipients for the NewMail object. Write-only. <BR><BR>Syntax <BR>objNewMail.Bcc <BR> <BR>Data Type <BR>String <BR><BR>Remarks <BR>The value you use to set the Bcc property can represent a single recipient or a list of recipients. Each recipient must be represented by a full messaging address: <BR><BR> "" <BR> <BR>Multiple recipients on the list are separated by semicolons: <BR><BR> ";;user3@compa" <BR>&#060;/snip&#062;<BR><BR>Hope this helps, I got it from Altavista by typing <BR>+CDONTS +bcc +multiple<BR>

Posting Permissions

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