Forums

email result to PMS (JIM) adress

jfkraaij 14 Jan, 2008
LS,

I am a happy user of chronoforms.

Using JIM PMS as privage message system, I wonder if it is possible to email the results of a chronoform to another user. I am using CB for my usermanagement.

In that case it will be possible to hold private information in a secured environment.

Thanx,

Frank<br><br>Post edited by: jfkraaij, at: 2008/01/14 00:52
GreyHead 14 Jan, 2008
Hi Frank,

You could almost certainly hack the ChronoForms code to replace the mail function call with a corresponding call from JIM.

Unfortunately the JIM download site is down at the moment so I can't look at the code to see what would be needed. If you want to email me the component at the address in my sig I'll take a quick look.

Bob
GreyHead 14 Jan, 2008
Hi Frank,

Thanks for the code. I had a quick look and found this in the CB bridge:
global $database;
$sql="
  INSERT 
    INTO #__jim (username, whofrom, date, readstate, subject, message) 
    VALUES('"	.$to."', '".$from."', NOW(), 0, '".$sub."', '".$msg."');";
$database->SetQuery($sql);
if (!$database->query()) {
  die("SQL error" . $database->stderr(true));
}
I think this would do the trick with a little modification.

Here's a first hack at it, I've changed the SQL format to make it a bit simpler to keep the Values clean. I think the place to put this is in the 'OnSubmit after email' box.
<?php		global $database, $my;
$from = $my->username;
$to = ???;
$sql="
  INSERT 
    INTO #__jim 
    SET username  = '$to',
        whofrom   = '$from',
        date      = NOW(),
        readstate = 0,
        subject   = '$subject',
        message   = '$html_message';";
$database->SetQuery($sql);
if (!$database->query()) {
  die("SQL error" . $database->stderr(true));
}
?>
I've left ??? in the $to variable as I'm not sure how you'd pick up the recipient's username. I guess that depends on your application.



Rough code! Not tested!

Bob
This topic is locked and no more replies can be posted.