Converting a small php mail app to a cf mail app, is it possible?
Hello;
I am trying to use a small app I picked up and it uses a php email tag in a java scrip / jquery based email applet for a web site. The php tag sends a callback to the jquery when the message is sent, if it doesn't, the jquery throws an error and tells the user nothing was sent. I know how to use a cfmail tag, but I am looking for help with sending the callback to the jquery.
I'm posting both sets of code, the php code, and then the cf code:
PHP version
<?php
//declare our assets
$name = stripcslashes($_POST['name']);
$emailAddr = stripcslashes($_POST['email']);
$comment = stripcslashes($_POST['comment']);
$subject = stripcslashes($_POST['subject']);
$contactMessage = "Message: $comment \r \n From: $name \r \n Reply to: $emailAddr";
//validate the email address on the server side
if(eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $emailAddr) ) {
//if successful lets send the message
mail('/*RECIPIENT EMAIL ADDRESS*/', $subject, $contactMessage);
echo('success'); //return success callback
} else {
echo('An invalid email address was entered'); //email was not valid
}
?>
This is the cf version I'm working on:
<cfparam name="FORM.name" default="">
<cfparam name="FORM.emailAddr" default="">
<cfparam name="FORM.comment" default="">
<cfmail to="info@astie.com"
from="#form.emailAddr#"
subject="Feedback"
type="html"
server="mail.asite.com"
port="25">
<cfmailparam name="X-Priority" value="1"/>
<font face="Verdana, Arial, Helvetica, sans-serif" color="##000000" size="2">
<b>Feedback Form!!</b><br>
<br>
<b>Customer Name:</b> #form.name#<br>
<b>Customer Email:</b> #form.emailAddr#<br>
<br />
<b>Feedback:</b><br>
#form.comment#</font><br>
<br>
</cfmail>
Is this possible? I was thinking a cfif statement.. but am a little unclear how to approach it. I can make the jquery available as well if needed, but If I mirror the code in the phpo it should work without having to mess with the java.
Thanks for any help.
