Email Form

Results 1 to 2 of 2

Thread: Email Form

  1. #1
    Join Date
    Dec 1969

    Default Email Form

    Does anyone know how I can do the following...I have an asp form that adds records to an access database. What I need is that if a specific check box is selected, an email will be sent. If the box is not checked, no mail will be sent. However, in both cases the information will be added to the database.<BR><BR>thanks!!!

  2. #2
    Join Date
    Dec 1969

    Default RE: Email Form

    &#039;Write to DB first<BR>...<BR>&#039;Then use CDONTS for email<BR>If Request.Form("yourcheckbox") = "checkedValue" Then<BR>Set objMail = Server.CreateObject("CDONTS.NewMail")<BR>objMail.T o =<BR>objMail.From =<BR>objMail.Subject = "Your Subject"<BR>objMail.Body = "The Body Of Your Email"<BR>objMail.Send<BR>Set objMail = Nothing<BR>End If<BR><BR>Please note: This doesn&#039;t tell you if the mail has been sent successfully. This is easily done, though - well at least, you can check if the server successfully attempted to send the mail. But to keep things simple, I haven&#039;t included code for this. Please note that you server must have the CDONTS component installed for this to work. If it&#039;s a Windows server, it almost certainly has it installed already. Also, I recommend you store your mail body in a variable before assigning it to CDONTS.<BR><BR>e.g.<BR><BR>strBody = "... whatever ..."<BR><BR>Then later when sending the email:<BR><BR>objMail.Body = strBody<BR><BR>You should also do this for the subject and the mail to/from fields, but this is not essential (just better coding in my opinion).

Posting Permissions

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