using a variable in the to field in CDONTS

Results 1 to 2 of 2

Thread: using a variable in the to field in CDONTS

  1. #1
    Join Date
    Dec 1969

    Default using a variable in the to field in CDONTS

    I have a contact form which passes a variable containing an email address for the "to" field to an ASP page using CDONTS to send the email. I am having a problem where it sends the email successfully sometimes, but other times it does not!?! Could this be a problem with the hosting company, or is my code incorrect?<BR><BR>The line of code in the contact form looks like this:<BR>&#060;INPUT TYPE=HIDDEN NAME="vemail" VALUE=""&#062;<BR><BR>The asp page that this info is passed to has this code:<BR><BR>strTo = Request.querystring("vemail")<BR><BR>Dim objCDO<BR> Set objCDO = Server.CreateObject("CDONTS.NewMail")<BR> objCDO.To = strTo<BR> objCDO.From = ""<BR> objCDO.Bcc = ""<BR> <BR> objCDO.Subject = strSubject<BR> objCDO.Body = strBody<BR> <BR> objCDO.Send<BR> <BR> Set objCDO = Nothing<BR> <BR> Response.Redirect strRedirectURL<BR>%&#062;<BR><BR>Thanks for any help or advice!!<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: using a variable in the to field in CDONTS

    I know exactly squat abour Cdonts, but I know that both JMail and ASPmail will break down if you pass a poorly formatted email address to them.<BR><BR>Try trimming the form-passed string to remove leading and/or trailing spaces like so:<BR><BR>strTo = Trim(strTo)

Posting Permissions

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