Hej
Jeg skal have lave en tilmeldings form på en webside. Jeg har fundet
nedenstående eksempel. Jeg har aldrig rodet med ASP før, så hvordan får jeg
det til at virke i praksis?
Jeg har prøvet at uploade det som sendmail.asp til min webside, men der sker
intet når jeg loader siden. Jeg har prøvet med et "Hello World" ASP
eksempel, og det virker ok
mvh Lars
<%
Dim strTo, strSubject, strBody 'Strings for recipient, Subject, Body
Dim objCDOMail 'The CDO object
StrTo = "test@test.dk"
strSubject = "Test mail"
strBody = Request.Form("Navn") & vbCrLF & vbCrLF
strBody = strBody & Request.Form("telefon") & vbCrLF
strBody = strBody & Request.Form("Email") & vbCrLF
strBody = strBody & Request.Form("firma") & vbCrLF
strBody = strBody & Request.Form("Adresse") & vbCrLF
strBody = strBody & Request.Form("PostnrBy") & vbCrLF & vbCrLF
' A final carriage return for good measure!
' strBody = strBody & vbCrLf
'Ok we've got the values now on to the point of the script.
'We just check to see if someone has entered anything into the to field. 'If
it's equal to nothing we show the form, otherwise we send the message. 'If
you were doing this for real you might want to check other fields too 'and
do a little entry validation like checking for valid syntax etc. ' Create an
instance of the NewMail object.
Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
' Set the properties of the object
' This syntax works fine
' objCDOMail.From = "webmaster@asp101.com"
' But this gets you the appearance of a real name!
objCDOMail.From = "info@test.dk"
objCDOMail.To = strTo
objCDOMail.Subject = strSubject
objCDOMail.Body = strBody
' There are lots of other properties you can use.
' You can send HTML e-mail, attachments, etc...
' You can also modify most aspects of the message
' like importance, custom headers, ...
' Check the documentation for a full list as well
' as the correct syntax.
' I've had several requests for how to send HTML email.
' To do so simply set the body format to HTML and then
' compose your body using standard HTML tags.
' objCDOMail.BodyFormat = 0 ' CdoBodyFormatHTML
' Some of the more useful ones I've included samples of here:
' objCDOMail.Cc = "info@test.dk"
' objCDOMail.Bcc = "john@asp101.com;gary@asp101.com"
' objCDOMail.Importance = 1 '(0=Low, 1=Normal, 2=High)
' objCDOMail.AttachFile "c:\path\filename.txt", "filename.txt"
' Send the message!
objCDOMail.Send
' Set the object to nothing because it immediately becomes
' invalid after calling the Send method.
Set objCDOMail = Nothing
%>