Welcome to HostingForumz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

JMail asp code problem - new user

 
   Web Hosting Problem Solving Community! (Home) -> IIS RSS
Next:  Problem with debug diagnostic tool  
Author Message
pdd

External


Since: Mar 22, 2006
Posts: 2



(Msg. 1) Posted: Wed Mar 22, 2006 2:56 am
Post subject: JMail asp code problem - new user
Archived from groups: microsoft>public>inetserver>iis (more info?)

I am new to asp's and recently added a simple form to my website. My
hosts sent me a sample code of VBscript to use as the asp, but I cannot
seem to work out why it is not working. I know it's probably going to
be something very obvious, but after two weeks of trying to work it out
with differing variations to the code, I'm desperate for some help.

This is the base code they sent me;

<%@LANGUAGE = VBSCRIPT%>
<html>
<body>

<%
' Get the form data
name = Request.Form("name")
senderEmail = Request.Form("email")
subject = "Regarding " & Request.Form("subject")
recipient = Request.Form("recipient")
body = Request.Form("body")
strReferer = request.servervariables("HTTP_REFERER")
strServer = Replace(request.servervariables("SERVER_NAME"),"www.","")
strSMTPServer = "smtp." & strServer

' check referer
intComp = inStr(strReferer, strServer)
If intComp > 0 Then
blnSpam = False
Else
' Spam Attempt Block
blnSpam = True
End If

' Create the JMail message Object
set msg = Server.CreateOBject( "JMail.Message" )

' Set logging to true to ease any potential debugging
' And set silent to true in case you wish to handle the errors yourself
msg.Logging = true
msg.silent = true

' Enter the sender data
msg.From = senderEmail

' Note that as addRecipient is a method and not
' a property, you do not use an equals ( = ) sign
msg.AddRecipient recipient

' The subject of the message
msg.Subject = subject

' And the body
msg.body = body

' Now send the message, using the indicated mailserver
If NOT blnSpam Then

if not msg.Send(strSMTPServer ) then
Response.write "<pre>" & msg.log & "</pre>"
else
Response.write "Message sent successfully!"
end if

end if

' Clear the object
set msg = nothing
%>
</body>
</html>

Any advice would be greatfully appreciated.

PDD

 >> Stay informed about: JMail asp code problem - new user 
Back to top
Login to vote
pdd

External


Since: Mar 22, 2006
Posts: 2



(Msg. 2) Posted: Wed Mar 22, 2006 9:25 am
Post subject: Re: JMail asp code problem - new user [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

I haven't tried that. I did not realise there was a way of testing the
asp.

I tried a combination of different additions to the script (adding web
addresses and email addresses to the section below as I thought this
might be where the error was occuring.
'strReferer = request.servervariables("HTTP_REFERER")
strServer = Replace(request.servervariables("SERVER_NAME"),"www.","")
strSMTPServer = "smtp." & strServer'

and then adding the asp to the files held by my host via FTP.

On the website the error code came up 'HTTP' 401 error when I tried to
'submit' the enquiry form. I was trying to learn using some example
script, which seemed to have some reference to where the email should
be sent.

Is there somewhere that I could get an example of how to run that test,
if you think that may be where the error is occuring. I went through
the Dimac site but found little explanation for someone of virtually no
experience of asp like me.

Thanks for your help in advance,

PDD

 >> Stay informed about: JMail asp code problem - new user 
Back to top
Login to vote
Display posts from previous:   
   Web Hosting Problem Solving Community! (Home) -> IIS All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]