Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Add a notification by email.

Posted on 2004-09-02
2
Medium Priority
?
267 Views
Last Modified: 2011-09-20
Hi,

Thank you in advance for your time.  I have a online form on the web, with fields.  The user fill the forms and all the information go to a DB -- Table which is fine and correct.   I'm looking to add a line just to notify the user that an information has been fill, like in Coldfusion CFMAIL to:'user' a user has submit a form, please check the database.

So my question how i'm able to add to this code an emial notification saying a user has submit this form, please see Database.  Anyone know to add this line in ASP . Please advice and thank you.

God bless!

This is the actual code.  I'm looking to add a cfmail but in ASP .
Thank you
Ely.
<%
' FP_ASP ASP Automatically generated by a Frontpage Component. Do not Edit.

On Error Resume Next
Session("FP_OldCodePage") = Session.CodePage
Session("FP_OldLCID") = Session.LCID
Session.CodePage = 1252
Err.Clear

strErrorUrl = ""

If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
If Request.Form("VTI-GROUP") = "0" Then
      Err.Clear

      Set fp_conn =  Server.CreateObject("ADODB.Connection")
      FP_DumpError strErrorUrl, "Cannot create connection"

      Set fp_rs = Server.CreateObject("ADODB.Recordset")
      FP_DumpError strErrorUrl, "Cannot create record set"

      fp_conn.Open Application("orderwork_ConnectionString")
      FP_DumpError strErrorUrl, "Cannot open database"

      fp_rs.Open "Results", fp_conn, 1, 3, 2 ' adOpenKeySet, adLockOptimistic, adCmdTable
      FP_DumpError strErrorUrl, "Cannot open record set"

      fp_rs.AddNew
      FP_DumpError strErrorUrl, "Cannot add new record set to the database"
      Dim arFormFields0(23)
      Dim arFormDBFields0(23)
      Dim arFormValues0(23)

      arFormFields0(0) = "Telephone"
      arFormDBFields0(0) = "Telephone"
      arFormValues0(0) = Request("Telephone")
      arFormFields0(1) = "PostalCode"
      arFormDBFields0(1) = "PostalCode"
      arFormValues0(1) = Request("PostalCode")
      arFormFields0(2) = "QuantityEnglish"
      arFormDBFields0(2) = "QuantityEnglish"
      arFormValues0(2) = Request("QuantityEnglish")
      arFormFields0(3) = "QuantityFrench"
      arFormDBFields0(3) = "QuantityFrench"
      arFormValues0(3) = Request("QuantityFrench")
      arFormFields0(4) = "Address_sh"
      arFormDBFields0(4) = "Address_sh"
      arFormValues0(4) = Request("Address_sh")
      arFormFields0(5) = "Title"
      arFormDBFields0(5) = "Title"
      arFormValues0(5) = Request("Title")
      arFormFields0(6) = "City_sh"
      arFormDBFields0(6) = "City_sh"
      arFormValues0(6) = Request("City_sh")
      arFormFields0(7) = "Email_sh"
      arFormDBFields0(7) = "Email_sh"
      arFormValues0(7) = Request("Email_sh")
      arFormFields0(8) = "TotalEnglish"
      arFormDBFields0(8) = "TotalEnglish"
      arFormValues0(8) = Request("TotalEnglish")
      arFormFields0(9) = "TotalFrench"
      arFormDBFields0(9) = "TotalFrench"
      arFormValues0(9) = Request("TotalFrench")
      arFormFields0(10) = "Telephone_sh"
      arFormDBFields0(10) = "Telephone_sh"
      arFormValues0(10) = Request("Telephone_sh")
      arFormFields0(11) = "Fax"
      arFormDBFields0(11) = "Fax"
      arFormValues0(11) = Request("Fax")
      arFormFields0(12) = "Fax_sh"
      arFormDBFields0(12) = "Fax_sh"
      arFormValues0(12) = Request("Fax_sh")
      arFormFields0(13) = "City"
      arFormDBFields0(13) = "City"
      arFormValues0(13) = Request("City")
      arFormFields0(14) = "Email"
      arFormDBFields0(14) = "Email"
      arFormValues0(14) = Request("Email")
      arFormFields0(15) = "Name"
      arFormDBFields0(15) = "Name"
      arFormValues0(15) = Request("Name")
      arFormFields0(16) = "OrderedBy"
      arFormDBFields0(16) = "OrderedBy"
      arFormValues0(16) = Request("OrderedBy")
      arFormFields0(17) = "PostalCode_sh"
      arFormDBFields0(17) = "PostalCode_sh"
      arFormValues0(17) = Request("PostalCode_sh")
      arFormFields0(18) = "OrderedBy_sh"
      arFormDBFields0(18) = "OrderedBy_sh"
      arFormValues0(18) = Request("OrderedBy_sh")
      arFormFields0(19) = "Title_sh"
      arFormDBFields0(19) = "Title_sh"
      arFormValues0(19) = Request("Title_sh")
      arFormFields0(20) = "Address"
      arFormDBFields0(20) = "Address"
      arFormValues0(20) = Request("Address")
      arFormFields0(21) = "Name_sh"
      arFormDBFields0(21) = "Name_sh"
      arFormValues0(21) = Request("Name_sh")
      arFormFields0(22) = "TOTAL"
      arFormDBFields0(22) = "TOTAL"
      arFormValues0(22) = Request("TOTAL")

      FP_SaveFormFields fp_rs, arFormFields0, arFormDBFields0


      fp_rs.Update
      FP_DumpError strErrorUrl, "Cannot update the database"

      fp_rs.Close
      fp_conn.Close

      Session("FP_SavedFields")=arFormFields0
      Session("FP_SavedValues")=arFormValues0
      Session.CodePage = Session("FP_OldCodePage")
      Session.LCID = Session("FP_OldLCID")
      Response.Redirect "index.asp"

End If
End If

Session.CodePage = Session("FP_OldCodePage")
Session.LCID = Session("FP_OldLCID")

%>
<html>
0
Comment
Question by:elieazzi
  • 2
2 Comments
 
LVL 11

Accepted Solution

by:
L00M earned 2000 total points
ID: 11966413
Add this sub whereever you choose:

Sub SendEmail(ToAddress, FromAddress, Subject, Body)
    Dim MyCDONTSMail2
    Dim HTML
    Set MyCDONTSMail2 = CreateObject("CDONTS.NewMail")
    HTML = "<!DOCTYPE HTML PUBLIC""-//IETF//DTD HTML//EN"">" & vbcrlf
    HTML = HTML & "<html>" & vbcrlf
    HTML = HTML & "<head>" & vbcrlf
    HTML = HTML & "<title>APS University Registration</title>" & vbcrlf
      HTML = HTML & "<link rel='stylesheet' href='"& BaseURL &"supportfiles/style.css' type='text/css'>" & vbcrlf
    HTML = HTML & "</head>" & vbcrlf
    HTML = HTML & "<body>" & vbcrlf
      ' It fails for some reason if I include a picture...
      'HTML = HTML & "<img src='' border='0'><br>"
      HTML = HTML & "<br>" & vbcrlf
      HTML = HTML & Body & vbcrlf
    HTML = HTML & "</body>" & vbcrlf
    HTML = HTML & "</html>" & vbcrlf
    MyCDONTSMail2.From= FromAddress
    MyCDONTSMail2.To=ToAddress
    MyCDONTSMail2.Subject=Subject
    MyCDONTSMail2.BodyFormat=0
    MyCDONTSMail2.MailFormat=0
    MyCDONTSMail2.Body=HTML
    MyCDONTSMail2.Send
    Set MyCDONTSMail2=nothing
End Sub

Then call it like:

Dim Body
Body = ""
Body = "<table cellpadding=0 cellspacing=0 border=0><tr><td>Here's the email body</td></tr></table>"

SendEmail "someone@somewhere.com", "me@here.com", "Here's the email", Body

That's for sending HTML emails. I can provide a plaintext as well.

NB
0
 
LVL 11

Expert Comment

by:L00M
ID: 11966421
Oops, you may want to change that title ;)
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Six Sigma Control Plans

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question