When you're a user of CK Forms, you undoubtedly came across the following issue:
If a visitor sends an email from your form, CK Forms sends the results to you using the mail address you have given in in the Mail TO field in the E-Mail tab in CK Forms.
The problem with this is that, when you want to reply to the visitor, you cannot just hit the reply button but need to copy the sender's mail address to your To field in your mail client. Otherwise you send the mail straight back to yourself!
Is this logical? I don't think so!
It took me some months of living with it and trying to find a solution to the problem, and I finally came across the solution in the CK Forms forum.
A fine programmer going by the name of Rahul Chand made a hack that solved the entire issue!
The Solution
Fire up your favorite FTP client and go to folder components/com_ckforms/models/ in your Joomla! install.
Download file ckforms.php and open it in Notepad.
Search for the line that says:
$mailBody = $mailBody.JText::_( 'IP Address' ) . " : " . $_SERVER['REMOTE_ADDR'] . "<br/>\n";
Under this line, add the following lines:
// Rahul Chand – Start Hack
function get_emails ($str)
{
$emails = array();
preg_match_all('/(\w+\.)*\w+@(\w+\.)*\w+(\w+\-\w+)*\.\w+/', $str, $output);
foreach($output[0] as $email) array_push ($emails, strtolower($email));
if (count ($emails) >= 1) return $emails;
else return false;
}
# Sample string containing email addresses;
$str = $mailBody;
# Get the emails on arrays;
$emails = get_emails ($str);
// Rahul Chand – End Hack
Next, search for the following line:
$mail->setSender( array( $ckform->emailfrom, "" ) );
Replace this line with the following code:
// Rahul Chand – Call Email address from above hack
$mail->setSender($emails);
// Rahul Chand – End Hack
Replace the ckforms.php on the server with the altered copy.
Next time an email is send using the form, you will receive the mail from the actual sender!
Other Cleanup Hacks
While you are messing about in the ckforms.php file, you might want to consider cleaning up the mails CK Forms sends out a little.
Some of the changes I made:
Changing wording
The following line tells you at what date and time the mail is sent. The wording in it is 'registered at'… Not very logical in a mail, especially when you want to reply to it, now is it. I changed the line from:
$mailBody = $mailBody."registered at ".date("Y-m-d H:i:s")."<br /><br />\n\n";
to
$mailBody = $mailBody."Sent at ".date("Y-m-d H:i:s")."<br /><br />\n\n";
Taking out the IP Address and the ID number
The default mail CK Forms sends to you also has the IP Address of the sender and the ID number of the mail in it. I don't think this is very helpful, and it looks kinda techie when the sender sees it in your reply. I therefore commented out these lines (put // in front of the lines):
// $mailBody = $mailBody.JText::_( 'IP Address' ) . " : " . $_SERVER['REMOTE_ADDR'] . "<br />\n";
and
// $mailBody = $mailBody.JText::_( 'Article ID' ) . " : " . $articleid . "<br />\n";
Taking out the form name and date on the sender's receipt email
What's the added value for the sender to know what form name the form was he send the mail from, or what date and time he sent it (he knows that!)? I suggest commenting out these lines:
// $mailBody = $mailBody."<br/><br/>Form : ".$ckform->title."<br />\n";
// $mailBody = $mailBody.JText::_( 'registered at' )." ".date("Y-m-d H:i:s")."<br /><br />\n\n";
Hopfully this solves some of the issues you may have with CK Forms. I hope that next version will have these options built in, so we don't have to hack files ourselves!
_____________________________________________________________________________________________Robin Roelofsen
"I think complexity is mostly sort of crummy stuff that is there because it's too expensive to change the interface."
Jaron Lanier

Thanks for publishing these hackes, it realy inproves ckForms.
Jade
hi, thanks for the article, it give ckForm more functionality.
I would to know that you can help in more hack on ckForm.
In the Ckform admin area, in the tab E-mail, there is two group, which is 'email Result' and 'email Receipt'.
but the 'email Result' doesn't have custom text editor like 'email receipt'
I want both email result and receipt have custom additional text message. How to make this happen?
Any help will be appreciate. sorry my bad english.
Email result is the mail YOU get from CK Forms, which is the mail the sender sent to you. Sorry, no additional info can be added, although maybe in the PHP file, but I am not a PHP whiz…
Thanks a lot, Robin!
This perfomances make CKForms fully operative for socials campaigns (i.e. "Send this message to your president")
An example (in spanish) is now working in our website (http://codpi.org/index.php?option=com_content&view=section&layout=blog&id=5&Itemid=70)
Thanks again,
Mestizo