[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 221
  • Last Modified:

Send web form to email and value to Paypal

I have an ASP web form that sends a calculated value to PayPal. It works great.  There is other form content on the same form that I would like to be sent in an email before (or after) going to Paypal for processing.  Is there any way to send the form content to an email and send a value to Paypal?
0
gwr477
Asked:
gwr477
  • 4
  • 3
  • 2
1 Solution
 
RimvisCommented:
Hello gwr477,

Do you need help about sending e-mail from ASp? In this case, look here:

How do I send e-mail with CDO?
http://classicasp.aspfaq.com/email/how-do-i-send-e-mail-with-cdo.html

Regards,

Rimvis
0
 
gwr477Author Commented:
I know how to send form data to email and I know how to pass a total to Paypal.  What I don't know is how to do both at the same time.
0
 
RimvisCommented:
Sorry, but I can't see where is you problem.
How do you pass value to PayPal? On form submit? Just call your email function there.

Do you have problem with sending form content? Take a look here:

A versatile HTML form mail script for classic ASP
http://www.codeproject.com/asp/sendmail.asp
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
gwr477Author Commented:
I have a web form that has javascript calculate and display a total.  When I press the submit button, it passes that value to Paypal.  Somehow, I need to also send the rest of the form content to an email.  Does that explain it?
0
 
swinslowCommented:
Intead of posting yor form to PayPal, post it to a page on your server for processing. From that page, process and send your email then Response.Redirect to PayPal with your values.  The address you will want to redirect to is https://www.paypal.com/cgi-bin/webscr?cmd=_xclick then pass all your variables with it in the QueryString for example:
https://www.paypal.com/cgi-bin/webscr?cmd=_xclick?business=Me@here.com&item_name=Gizmo&amount=99.99

It is the same address you would want to use if you were too use a link instead of a form to post to PayPal.

0
 
gwr477Author Commented:
The QueryString example would not display.
0
 
swinslowCommented:

Sure it would. Here is an example:

 Your form:
 <form name="PayPalForm" method="post" action="DoStuff.asp">
 <input type="hidden" name="item_name" value="Gizmo Thing">
 <input type="hidden" name="amount" value="99.99">
 Name: <input type="text" name="CustomerName"><br>
 Email: <input type="text" name="CustomerEmail"><br>
 <!- Plus whatever else fields you want or need visible or hidden-->
 </form>
 
 On the DoStuff.asp page:
 <%
  CustomerName = Request("CustomerName")
  CustomerEmail = Request("CustomerEmail")
  item_name = Request("item_name")
  amount = Request("amount")

  MailBody = "Whatever you want your message to be. " & _
             "Maybe include: " & _
             "Customer Name = " & CustomerName & "<br>" & _
             "Customer Email = " & CustomerEmail & "<br>"
  'Send Mail
  Set ObjNM=CreateObject("CDO.Message")
      ObjNM.Subject = "Your Email Subject"
      ObjNM.From = "Me@here.com"
      ObjNM.To = CustomerEmail
      ObjNM.HTMLBody = MailBody
      ObjNM.Send
  Set ObjNM = Nothing

  'Redirect to PayPal
  Response.Redirect "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick" & _
                    "&business=Me@here.com" & _
                    "&item_name=" & item_name & _
                    "&amount=" & amount
                    'Plus whatever else fields you need to pass

 %>
0
 
swinslowCommented:

Now, if you are attempting to make it so the visitor stays on the same page put all this on the same page:

 <%
   If Request("DoStuff") = "Do Stuff" Then
      CustomerName = Request("CustomerName")
      CustomerEmail = Request("CustomerEmail")
      item_name = Request("item_name")
      amount = Request("amount")

      MailBody = "Whatever you want your message to be. " & _
                 "Maybe include: " & _
                 "Customer Name = " & CustomerName & "<br>" & _
                 "Customer Email = " & CustomerEmail & "<br>"
      'Send Mail
      Set ObjNM=CreateObject("CDO.Message")
          ObjNM.Subject = "Your Email Subject"
          ObjNM.From = "Me@here.com"
          ObjNM.To = CustomerEmail
          ObjNM.HTMLBody = MailBody
          ObjNM.Send
      Set ObjNM = Nothing

      PayPalURL = "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick" & _
                  "&business=Me@here.com" & _
                  "&item_name=" & item_name & _
                  "&amount=" & amount
                  'Plus whatever else fields you need to pass
     %>
       <script language="JavaScript">
           window.open("<%=PayPalURL%>","PayPal")
       </script>
     <%
       Response.Write "Thank You For Your Order"
   End If
 %>

 <form name="PayPalForm" method="post">
 <input type="hidden" name="item_name" value="Gizmo Thing">
 <input type="hidden" name="amount" value="99.99">
 Name: <input type="text" name="CustomerName" value="<%=CustomerName%>"><br>
 Email: <input type="text" name="CustomerEmail" value="<%=CustomerEmail%>"><br>
 <input type="submit" name="DoStuff" value="Do Stuff">
 <!- Plus whatever else fields you want or need visible or hidden-->
 </form>


 So anyway, you now have two examples of how to send an email to whoever and post to PayPal from a single form.
 
 Soren
0
 
gwr477Author Commented:
This is the correct solution. Nice work Expert.
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.

  • 4
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now