SSL Secure Web space & CGI, Jmail or CDONTS?

  • happy100
  • Born
  • Born
  • happy100
  • Posts: 3

Post 3+ Months Ago

Hi

I have a web site and we use a cgi formmail script to receive our orders via email from the script, but currently we telephone the customers for their credit card details.

The remote web hosting company we use offers SSL web space which we thought about using for getting the customers to add their credit card details into the form, so we could receive it via the same email as their order details.

But I have been told that cgi formmail script is not available and that we would have to use Jmail or CDONTS.

I have never heard of either of these and could do with some helps with how these might work with our situation?
If anyone could shine some light on this for me, it would be very much appreciated.

Many thanks

Craig.


--


Looking for some where to stay in the UK & Ireland?
http://www.ComeStayWithUs.com
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Carnix
  • Guru
  • Guru
  • User avatar
  • Posts: 1098

Post 3+ Months Ago

Craig,
CDONTS is an ASP object, Jmail is the JSP servlet equivalent. I know nearly nothing about JSP.. but here's a tried and true CDONTS script I've used many times over:

Code: [ Select ]
<%
sub send_mail(efrom,eto,esubject,ebody)
 set obj_sendmail = Server.CreateObject("CDONTS.NewMail")
 with obj_sendmail
  .from = efrom
  .to = eto
  .subject = esubject
  .body = ebody
  .send
 end with
set obj_sendmail = nothing
end sub

sendto = "webmaster@care.org"
sendfrom = "someone@here.com"
subject_line = "Hello, this is an e-mail!"
message_body = "hello there!" & vbNewLine & "How are you today?!"

call send_mail(sendto,sendfrom,subject_line,message_body)

%>
  1. <%
  2. sub send_mail(efrom,eto,esubject,ebody)
  3.  set obj_sendmail = Server.CreateObject("CDONTS.NewMail")
  4.  with obj_sendmail
  5.   .from = efrom
  6.   .to = eto
  7.   .subject = esubject
  8.   .body = ebody
  9.   .send
  10.  end with
  11. set obj_sendmail = nothing
  12. end sub
  13. sendto = "webmaster@care.org"
  14. sendfrom = "someone@here.com"
  15. subject_line = "Hello, this is an e-mail!"
  16. message_body = "hello there!" & vbNewLine & "How are you today?!"
  17. call send_mail(sendto,sendfrom,subject_line,message_body)
  18. %>



You need to use other ASP scripting to get your form data. While I usually use another function I've written to make things easier for me, the basic way you can do that is:

yourvar = Request.Form("ElementName")

Note, ASP is NOT CaSe SensItivE, when written in VBScript (which is how I do it... ok.. technically, ASP isn't a language and VBScript isn't case sensitive... =P )
  • happy100
  • Born
  • Born
  • happy100
  • Posts: 3

Post 3+ Months Ago

Hi Carnix

Thanks for the code.
I have only just started using asp and it's all a bit daunting, wood there be any chance you could provide me with the full page code for a form to me sent with name and email as the form fields.
Making it clear where I need to change the script with my details etc.

I then could use your code to learn how to expand the form to include other form fields.

Hope you can help.

Many thanks

Craig.
  • Carnix
  • Guru
  • Guru
  • User avatar
  • Posts: 1098

Post 3+ Months Ago

Put the following functions in a common include file. I usually call it common.asp. It holds a bunch of functions and subs (nothing else).

Code: [ Select ]
sub send_mail(efrom,eto,esubject,ebody)
 set obj_sendmail = Server.CreateObject("CDONTS.NewMail")
 with obj_sendmail
  .from = efrom
  .to = eto
  .subject = esubject
  .body = ebody
  .send
 end with
set obj_sendmail = nothing
end sub

    function get_param(param_name)
        if(Request.QueryString(param_name).count > 0) then
            param = Request.QueryString(param_name)
        elseif(Request.Form(param_name).count > 0) then
            param = Request.Form(param_name)
        else
            param = ""
        end if
        if(param = "") then
            get_param = empty
        else
            get_param = param
        end if
    end function

    function get_http(v)
        get_http= Request.ServerVariables(v)
    end function
  1. sub send_mail(efrom,eto,esubject,ebody)
  2.  set obj_sendmail = Server.CreateObject("CDONTS.NewMail")
  3.  with obj_sendmail
  4.   .from = efrom
  5.   .to = eto
  6.   .subject = esubject
  7.   .body = ebody
  8.   .send
  9.  end with
  10. set obj_sendmail = nothing
  11. end sub
  12.     function get_param(param_name)
  13.         if(Request.QueryString(param_name).count > 0) then
  14.             param = Request.QueryString(param_name)
  15.         elseif(Request.Form(param_name).count > 0) then
  16.             param = Request.Form(param_name)
  17.         else
  18.             param = ""
  19.         end if
  20.         if(param = "") then
  21.             get_param = empty
  22.         else
  23.             get_param = param
  24.         end if
  25.     end function
  26.     function get_http(v)
  27.         get_http= Request.ServerVariables(v)
  28.     end function



Then, on your form page, you do something like:





Code: [ Select ]

<!-- #include VIRTUAL="/includes/common.asp" -->
<%
    submit = get_param("submit")
    thank_you = ""
    if(submit = "send") then
        efrom = get_param("send_from")
        eto = get_param("send_to")
        esubject = get_param("send_subject")
        ebody = get_param("send_body")
        call send_mail(efrom,eto,esubject,ebody)
        thank_you = "<b>Your Message Has Been Sent</b>"
    end if
%>
<html>
<%=thank_you%>
<form ACTION="<%=get_http("URL")% METHOD="POST">
Send To: <input TYPE="text" NAME="send_to" VALUE=""><br>
From: <input TYPE="text" NAME="send_from" VALUE=""><br>
Subject: <input TYPE="text" NAME="send_subject" VALUE=""><br>
Message:<br><textarea NAME="send_body" WRAP="virtual"></textarea>
<input TYPE="submit" NAME="submit" VALUE="send">
</form>
</html>
  1. <!-- #include VIRTUAL="/includes/common.asp" -->
  2. <%
  3.     submit = get_param("submit")
  4.     thank_you = ""
  5.     if(submit = "send") then
  6.         efrom = get_param("send_from")
  7.         eto = get_param("send_to")
  8.         esubject = get_param("send_subject")
  9.         ebody = get_param("send_body")
  10.         call send_mail(efrom,eto,esubject,ebody)
  11.         thank_you = "<b>Your Message Has Been Sent</b>"
  12.     end if
  13. %>
  14. <html>
  15. <%=thank_you%>
  16. <form ACTION="<%=get_http("URL")% METHOD="POST">
  17. Send To: <input TYPE="text" NAME="send_to" VALUE=""><br>
  18. From: <input TYPE="text" NAME="send_from" VALUE=""><br>
  19. Subject: <input TYPE="text" NAME="send_subject" VALUE=""><br>
  20. Message:<br><textarea NAME="send_body" WRAP="virtual"></textarea>
  21. <input TYPE="submit" NAME="submit" VALUE="send">
  22. </form>
  23. </html>


Obviously, make sure you save it as .asp, and are on an IIS server, and the systems administrator hasn't disabled CDONTS.

This is a really simple way to do it. I don't use CDONTS anymore, in favor of a little program called Blat that allows for MANY more options. CDONTS.newmail is the way to go in the beginning.

.c
  • happy100
  • Born
  • Born
  • happy100
  • Posts: 3

Post 3+ Months Ago

Thank you!

I have a slight script problem, this is the whole script of my page -

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- #include VIRTUAL="/includes/common.asp" -->
<%
submit = get_param("submit")
thank_you = ""
if(submit = "send") then
efrom = get_param("send_from")
eto = get_param("send_to")
esubject = get_param("send_subject")
ebody = get_param("send_body")
call send_mail(efrom,eto,esubject,ebody)
thank_you = "<b>Your Message Has Been Sent</b>"
end if
%>
<html>
<%=thank_you%>
<form ACTION="<%=get_http("URL")% METHOD="POST">
Send To: <input TYPE="text" NAME="send_to" VALUE=""><br>
From: <input TYPE="text" NAME="send_from" VALUE=""><br>
Subject: <input TYPE="text" NAME="send_subject" VALUE=""><br>
Message:<br><textarea NAME="send_body" WRAP="virtual"></textarea>
<input TYPE="submit" NAME="submit" VALUE="send">
</form>
</html>

and the script error says -

Active Server Pages error 'ASP 0116'

Missing close of script delimiter

/formsend_2pk49yqkit.asp, line 18

The Script block lacks the close of script tag (%>)


Have I missed something out?

Many thanks again.

Craig.
  • Carnix
  • Guru
  • Guru
  • User avatar
  • Posts: 1098

Post 3+ Months Ago

Sorry... that way my error :oops:

Change:
Code: [ Select ]
<form ACTION="<%=get_http("URL")% METHOD="POST">


To:

Code: [ Select ]
<form ACTION="<%=get_http("URL")%>" METHOD="POST">


I left out the closing ASP tag...
.c

Post Information

  • Total Posts in this topic: 6 posts
  • Users browsing this forum: No registered users and 79 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.