Har ett script i cdonts som skickar e-post från en enkel sida. Vanligt kontaktformulär som fungerar bra på så sätt att mejlen i alla fall kommer fram. Brukar göra formulär i Jmail men webbservern för denna sida stödjer inte det. Problemen är två;CDONTS svenska tecken och html
- främst att svenska tecken som å, ä och ö inte kommer med i bodyn när mejlet tas emot. Fungerar dock bra i ämnesraden.
- samt att jag gärna vill ändra utseendet på mejlet, dvs i vilken ordning uppgfiterna skrivs ut mm. Hittar dock inte detta i den fil jag fick av webbhotellet för att skicka formuläret.
Den filen som det skickas via heter sendform.asp (kod nedan), och formuläret ligger i en separat asp-fil på sidan.
sendform.asp:
<%
'###################### READ THIS FIRST ########################
'#################################################################
'TO PERSONALIZE YOUR EMAIL MESSAGES OR TO CHANGE TECHINAL
'SETTINGS, PLEASE SCROLL DOWN TO "EDIT ONLY THESE LINES" AREA
' BEWARE !!!!!
'----------------
'Your form should contain a field named 'Email' where the visitor
'should enter his or her e-mail address. When you give this field
'the name e-mail or emailaddress or anything else IT WON'T WORK !!
'IT CAN ONLY BE 'Email'.
'#################################################################
'#################################################################
'*****************************************************************
'DETECT FORM VARIABLES
'*****************************************************************
email_var_present = 0
if len(request.form) > 1 then
'Loop to find each variable name and varible value
for each variable_name in request.form
dim variable_name
variable_value=request.form(variable_name)
HTML_VAR_TAGS = HTML_VAR_TAGS & variable_name & " = " & variable_value & "<br>" & chr(13)
if variable_name = "Email" then
email_var_present = 1
Email = variable_value
end if
next ' end for next loop for all
else
'if no form values are passed end file response and give error message:
response.write "No form values detected. File actions stopped."
response.end
end if
if email_var_present = 0 then
response.write "There is no input field named 'Email'. Make sure you have got a field named 'Email' in your form."
response.end
end if
Dim sendersname_Registrant, company_name, smtp_address, smtp_port, send_method, connection_timeout, smtp_authentication, ToClientSubject, ToAdminSubject, ToClientText, strEmailAdminister
'#################################################################
'#################################################################
'*****************************************************************
' EDIT ONLY THESE LINES:
'*****************************************************************
'#################################################################
'#################################################################
'##############
'** EDIT **
'EMAIL DETAILS
'##############
company_name = "foretag"
AdminEmail = "info@tagfish.se"
ToClientSubject = "Tack for ditt mail"
ToAdminSubject = "Meddelande skickat från hemsidan"
ConfirmationUrl = "tack.asp"
ToClientText = "<FONT SIZE='2' FACE='ARIAL'><p>Your reservervation was successfully received. Thank you for your trust in " & company_name & " !!<br><br>We will confirm your reservation as soon as possible.</p><p> </p><p>Kind regards,<br>" & company_name & "<br><br><br></FONT>"
ToAdminText = "<FONT SIZE='3' FACE='ARIAL'><p>Du har fått ett meddelande skickat från din hemsida.<br>Kontaktinformation:<br><br>" & HTML_VAR_TAGS & "</p></font>"
'== DON'T EDIT ==
strEmailAdminister = AdminEmail
sendersname_Registrant = company_name
finalsendersname_Registrant = sendersname_Registrant & " <" & Trim(strEmailAdminister) & ">"
'== DON'T EDIT ==
'###################
'** EDIT **
'TECHNICAL SETTINGS:
'###################
'THIS IS IMPORTANT !!! CHANGE THESE SETTINGS SO THEY WORK FOR YOUR SERVER !
'IF YOU DON'T KNOW THESE SETTINGS, ASK YOUR HOSTING PROVIDER.
'-------------------------------------------------------------
smtp_address= "smtp1.infracom.se"
'THIS COULD BE ANYTHING, ASK YOUR ISP FOR SMTP WEB DETAILS...
smtp_port = 25
connection_timeout = 10
'*****************************************************************
'/////////////////////////////////////////////////////////////////
'#################################################################
'#################################################################
'*****************************************************************
'DECLARE OTHER VARIABLES
'*****************************************************************
' -- declare variables for html body tags --
dim HtmlStartTags, HtmlEndTags
HtmlStartTags = "<html><body>"
HtmlEndTags = "</body></html>"
'*****************************************************************
'*****************************************************************
'CONFIGURE GLOBAL SERVER SETTINGS
'=================================================================
response.Expires = -1000
Const cdoSendUsingMethod = _
"http://schemas.microsoft.com/cdo/configuration/sendusing"
Const cdoSendUsingPort = 2
Const cdoSMTPServer = _
"http://schemas.microsoft.com/cdo/configuration/smtpserver"
Const cdoSMTPServerPort = _
"http://schemas.microsoft.com/cdo/configuration/smtpserverport"
Const cdoSMTPConnectionTimeout = _
"http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"
Const cdoSMTPAuthenticate = _
"http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"
Const cdoBasic = 1
Const cdoSendUserName = _
"http://schemas.microsoft.com/cdo/configuration/sendusername"
Const cdoSendPassword = _
"http://schemas.microsoft.com/cdo/configuration/sendpassword"
Dim objConfig ' As CDO.Configuration
Dim objMessage ' As CDO.Message
Dim Fields ' As ADODB.Fields
'*****************************************************************
'SEND SECOND MAIL
'*****************************************************************
Set objConfig = Server.CreateObject("CDO.Configuration")
Set Fields = objConfig.Fields
With Fields
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = smtp_address
.Item(cdoSMTPServerPort) = smtp_port
.Item(cdoSMTPConnectionTimeout) = connection_timeout
.Item(cdoSMTPAuthenticate) = cdoBasic
.Update
End With
Set objMessage = Server.CreateObject("CDO.Message")
Set objMessage.Configuration = objConfig
With objMessage
.To = finalsendersname_Registrant
.From = Email
.Subject = ToAdminSubject
.HTMLBody = HtmlStartTags & ToAdminText & HtmlEndTags
.Send
End With
'********************************************************************
'WRITE CONFIRMATION TEXT
'********************************************************************
Set Fields = Nothing
Set objMessage = Nothing
Set objConfig = Nothing
response.redirect(ConfirmationUrl)
'####################################################################
'YOU CAN DOWNLOAD THIS ASP FILE IN .ZIP FILE AT
'WWW.ROELKROTTJE.NL
'####################################################################
%>