Here is a simple Form email script for any generic form. I needed a quick generic email script for a few basic websites on a non coldfusion server to be able to send email through a cf server. So this script takes a form submission from another server and emails it to
. It does check the referers IP address to make sure its a valid request.
<cfset inet_address = CreateObject("java", "java.net.InetAddress")>
<cfset referer= replaceNocase(cgi.HTTP_REFERER,'http://','')/>
<cfset referer= listGetAt(referer,1,'/')/>
<cfset host_IP = listLast(inet_address.getByName(referer),'/')>
<!---required parameters --->
<cfparam name="form.mailfrom" />
<cfparam name="form.mailto" />
<cfparam name="form.mailsubject" />
<cfparam name="form.success" />
<!---check the remote IP address so spammers cant abuse it --->
<cfif host_IP eq "192.168.1.1">
<cfoutput>
<cfmail to="#form.mailto#" from="#form.mailfrom#" subject="form.mailsubject" type="html">
<cfloop collection ="#form#" item="thisAttribute">
#thisAttribute#:#form[thisAttribute]#<br>
</cfloop>
</cfmail>
</cfoutput>
<cflocation url="#form.success#"/>
<cfelse>
wrong ipaddress
</cfif>
I know I know this is not an ideal situation and is pretty insecure. Sometimes you just have to do as the client asks
1 comment:
https://isocialhub.net/paypal-credit-card-generator/
Post a Comment