I had this code for version 2.3.9 on Joomla 1.x, now I'm moving the site to Joomla 1.5 and using version 3.1rc2.
I setup the new form so that it sends plain text email. So how change the following code to use what is available in 3.1?
A few things are being done:
1. grabs the requestid from a file and increments it
2. it takes the requestid and appends to the subject line
3. the requestid is substituted into the text of the email
4. the date is substituted into the text of the email
5. it write the requestid back to the file
This is code in the "On Submit code - before sending email" section:
This is my email template:
I setup the new form so that it sends plain text email. So how change the following code to use what is available in 3.1?
A few things are being done:
1. grabs the requestid from a file and increments it
2. it takes the requestid and appends to the subject line
3. the requestid is substituted into the text of the email
4. the date is substituted into the text of the email
5. it write the requestid back to the file
This is code in the "On Submit code - before sending email" section:
<?php
// handle request number
$myFile = "/home2/openspar/www/requestnum.txt";
// read number from file
$handle = fopen($myFile, 'r');
$serial = fread($handle, 3);
fclose($handle);
$serial++;
// update requestid in email template
$_POST['requestid'] = date('dmy').$serial;
$requestid = date('dmy').$serial;
$requestdate = date('r');
$html_message = str_replace("##requestid##", $requestid, $text_message);
$html_message = str_replace("##requestdate##", $requestdate, $text_message);
$rows[0]->emailsubject .= $requestid;
$data = sprintf("%'03u", $serial) . "\n";
echo $data;
// write updated request number back into file
$Handle = fopen($myFile, 'w');
fwrite($Handle, $data);
fclose($Handle);
// remove line breaker
$html_message = str_replace("\r\n", "", $html_message);
?>
This is my email template:
|####requestid####|{institution_name}|{institution_address}|{institution_city}|{institution_state}|{institution_country}|{institution_zipcode}|{name}|{address}|{city}|{state}|{country}|{zipcode}|{email}|{phone}|{affiliation}|{numboards}|{justification}|##requestdate##|{opt-in}|