asp/jmail?

kfc04

Beta member
Messages
4
I am trying to use an asp/jmail script on a form. When i place the following script in the form.asp at the very top of the document it works. However as this script remains in the actual page the form resides, it may cause the recipient to get spam mail. I tried to put the below script into a seperate asp file and make the form action that script. It executes the script fine and sends the user to the redirect page, making it appear all is well, however the email is never recieved by te recipient. Does anyone know why this occurs?

The script is as follows:

<%

if request.form("ranonce") = "true" then


Name = request.form("Name")
Email = request.form("E-mail")
Telephone = request.form("Telephone")
Address = request.form("Address")
Country = request.form("Country")
Postalcode = request.form("Postalcode")
Position = request.form("Position")
Organisation = request.form("Organisation")
Other = request.form("Other")
checkbox1 = request.form("checkbox1")
checkbox2 = request.form("checkbox2")


message = ""
message = name + " has made an enquiry on mydomain.com " & vbcrlf &vbcrlf


message = message + "Name: "
message = message + Name &vbcrlf
message = message + "Position: "
message = message + Position &vbcrlf
message = message + "Organisation: "
message = message + Organisation &vbcrlf
message = message + "Address: "
message = message + Address &vbcrlf
message = message + "Country: "
message = message + Country &vbcrlf
message = message + "Postcode: "
message = message + Postalcode &vbcrlf &vbcrlf
message = message + "Telephone: "
message = message + Telephone &vbcrlf
message = message + "E-Mail: "
message = message + Email &vbcrlf &vbcrlf

message = message + name + " would like more information on the following material: " & vbcrlf &vbcrlf

message = message + "checkbox1: "
message = message + checkbox1 &vbcrlf
message = message + "checkbox1: "
message = message + checkbox2 &vbcrlf
message = message + "checkbox2: "

set JMail = CreateObject("JMail.SMTPMAIL")

JMail.ServerAddress = "mail.myserver.co.uk"
JMail.Sender = "formail@mydomain.com"
JMail.SenderName = "Form Name"
JMail.AddRecipient "myemail@mydomain.com"
JMail.Priority = 1
JMail.Subject = "email subject"
JMail.Body = message
on error resume next
JMail.execute
on error goto 0
set JMail = nothing
Response.Redirect("http://www.mydomain.com/redirect.htm")
End if
%>

any help would be appreciated.
Thanks
 
if you have ASP why don't you use the CDOnts object for sending mail?

I cant think why this doesn't work, though I think you are right to be concerned with receiev4eing spam from email spiders that will get the address from the page. You could try storing the email address in a database, then you'd only get an address after the mail had been run once. (which a spider would not do)

Another thing you should be aware of is ASP happens server side, so you could just have the message posted to an email script, then all the addresses would be kept server side and the recipient need never know your address.
 
Back
Top Bottom