Forums
This topic is locked
Formmail Stuck pls help!
Posted 29 Jul 2007 00:24:31
1
has voted
29 Jul 2007 00:24:31 enoxh elow posted:
When I receive the results of a feedback form I would like the senders email address to be clickable.How do I do this?
Here is the asp formmail script I am using
<%@language=vbscript%>
<%option explicit
dim fromMail
fromMail = " "
dim mailBody
mailBody = "Below is the result of your feedback form. It was submitted by" & vbcrlf _
& Request.Form("email" & " on " & date() & vbcrlf & vbcrlf _
& "sender name: " & Request.Form("sendername" & vbcrlf & vbcrlf _
& "brides name: " & Request.Form("bridesname" & vbcrlf & vbcrlf _
& "grooms name: " & Request.Form("groomsname" & vbcrlf & vbcrlf _
& "address: " & Request.Form("address" & vbcrlf & vbcrlf _
& "city: " & Request.Form("city" & vbcrlf & vbcrlf _
& "state/province: " & Request.Form("state_province" & vbcrlf & vbcrlf _
& "zip/postal code: " & Request.Form("zip_postalcode" & vbcrlf & vbcrlf _
& "country: " & Request.Form("country" & vbcrlf & vbcrlf _
& "phone: " & Request.Form("phone" & vbcrlf & vbcrlf _
& "email: " & Request.Form("email" & vbcrlf & vbcrlf _
& "referred by: " & Request.Form("referredby" & vbcrlf & vbcrlf _
& "contact time: " & Request.Form("contacttime" & vbcrlf & vbcrlf _
& "package type: " & Request.Form("packagetype" & vbcrlf & vbcrlf _
& "party size: " & Request.Form("partysize" & vbcrlf & vbcrlf _
& "date: " & Request.Form("month" & "/" & Request.Form("day" & "/" & Request.Form("year" & vbcrlf & vbcrlf _
& "time: " & Request.Form("time" & vbcrlf & vbcrlf
if Request.Form("mailbrochure" = "" then
mailBody = mailBody & "would NOT like to receive a brochure by mail" & vbcrlf & vbcrlf
else
mailBody = mailBody & "would like to receive a brochure by mail" & vbcrlf & vbcrlf
end if
mailBody = mailBody & "comments: " & Request.Form("specialrequests" & vbcrlf & vbcrlf
Dim objCDO
Dim objConf
Dim objFields
Const cdoSendUsingPort = 2
Set objCDO = Server.CreateObject("CDO.Message"
Set objConf = Server.CreateObject("CDO.Configuration"
Set objFields = objConf.Fields
objFields.Item("schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
objFields.Item("schemas.microsoft.com/cdo/configuration/smtpserver") = "zzz.azzz.com"
objFields.Item("schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 15
objFields.Update
call sendmail(fromMail,Request.Form("recipient",Request.Form("subject",mailBody)
'Cleanup
Set ObjCDO = Nothing
Set objConf = Nothing
Set objFields = Nothing
Response.Redirect Request.Form("redirect"
' ********************************
' functions/subroutines follow
' ********************************
SUB sendmail( fromWho, toWho, Subject, Body )
on error resume next
Set objCDO.Configuration = objConf
objCDO.From = fromWho
objCDO.ReplyTo = Request.Form("email"
objCDO.To = toWho
objCDO.Subject = Subject
objCDO.TextBody = Body
objCDO.Send
on error goto 0
END SUB
%>
Thanks in advance if you can help!
Edited by - enoxh on 29 Jul 2007 00:57:11
Replies
Replied 21 Aug 2007 20:55:42
21 Aug 2007 20:55:42 Jon Jaques replied:
Hello, in order to make the email address clickable, you may just be able to pre-fix it with "mailto:", and then your email client may just make it clickable for you, with no further effort.
If it does not, you'll probably have to change to an HTML format email, so you'd have to change this:
objCDO.TextBody = Body
to this:
objCDO.HTMLBody = Body
You'd then probably want to replace
& vbcrlf & vbcrlf
with
& "<BR>" & vbcrlf
So that your lines are broken as expected.
Finally, though, I have a little trick that could save you some coding; I've pulled this little bit out of a page of mine which enumerates the fields of submitted form, and you should be able to adapt it to your needs if you like!
dim var, strOut
dim fieldName, fieldValue, ix
For ix = 1 to Request.Form.Count
fieldName = Request.Form.Key(ix)
fieldValue = Request.Form.Item(ix)
strOut = strOut & left(fieldName, len(fieldName)-4) & ": " & fieldValue & "<BR>"
Next
HTH!
--J
If it does not, you'll probably have to change to an HTML format email, so you'd have to change this:
objCDO.TextBody = Body
to this:
objCDO.HTMLBody = Body
You'd then probably want to replace
& vbcrlf & vbcrlf
with
& "<BR>" & vbcrlf
So that your lines are broken as expected.
Finally, though, I have a little trick that could save you some coding; I've pulled this little bit out of a page of mine which enumerates the fields of submitted form, and you should be able to adapt it to your needs if you like!
dim var, strOut
dim fieldName, fieldValue, ix
For ix = 1 to Request.Form.Count
fieldName = Request.Form.Key(ix)
fieldValue = Request.Form.Item(ix)
strOut = strOut & left(fieldName, len(fieldName)-4) & ": " & fieldValue & "<BR>"
Next
HTH!
--J