Welcome, Guest

Custom email notifications howto
(1 viewing) (1) Guest

TOPIC: Custom email notifications howto

Re:Custom email noHanstifications howto 3 years, 3 months ago #2705

Hi jimyjimjames. Let's see. By default if you tell breez to send the form to an email what happens is that all the fields appear in your email vertically. I'm assuming you got this far and that this is working properly for you?
Ok, next you'll notice that there are two files in the directory /administrator/components/com_facileforms/mailtpl/
which are mailtpl.txt.php and mailtpl.html.php.
So the code from breezing looks for a file in that directory by the name of 'yourformname.html.php' if it doesn't find it looks for 'yourformname.txt.php' then 'mailtpl.html.php' then 'mailtpl.txt.php'.

So you can create a new file there if you wish or just open up 'mailtpl.html.php' and change it.

If you open that one you'll see the php code that is creating your email.
You can use html and php to make this file send whatever email you desire.

At the bottom of the file you have this bit

<?php foreach ($MAILDATA as $DATA): ?>
<?=$DATA[_FF_DATA_TITLE]?>: <?=$DATA[_FF_DATA_VALUE]?><br /><?=$NL ?>
<?php endforeach; ?>

That's the part that is fetching your data and that's what you're interested in, if you know about all of what I've written above you can just start here but hey you had to read it all to get here anyway so I'm guessing this warning is irrelevant

Anyway, that cycle is going thru $data and it is fetching all the titles and values. Now, I haven't meddled with this so I'm gonna try to point you in the right direction. I don't know if this is all going over your head or if you understand php but if you don't let me know.
So one way that I can think of that could allow you to do what you want is to compare the data_title to your form field name so something like this could be used

if (strcasecmp($data[_FF_DATA_TITLE], "My field name")==0)

If that is true then it will mean that at that moment in the cycle "$data[_FF_DATA_VALUE]" will have the value that corresponds to the "my field name". At that point you could just say save it in a variable and after the cycle, get all the variables and organise it all in a table.

Anyhoo, get back to me if this was all very strange for you to follow and I'll try again.

Good luck.
Mori
  • moriwenne
  • OFFLINE
  • Junior Boarder
  • Posts: 24
  • Karma: 5

Re:Custom email noHanstifications howto 3 years, 3 months ago #2706

hi mori

i think i understand but what is the if statement you wrote without the emoticon lol?

Thank you so much for your help
James Ashworth
Mediart Solutions
www.mediart.com.au

Re:Custom email noHanstifications howto 3 years, 3 months ago #2707

lol damn smilies
just in case you were not joking

if (strcasecmp($data[_FF_DATA_TITLE], "My field name" == 0)

cheers
Mori
  • moriwenne
  • OFFLINE
  • Junior Boarder
  • Posts: 24
  • Karma: 5

Re:Custom email noHanstifications howto 3 years, 3 months ago #2708

so to clarifiy it would look something like

<?php foreach ($MAILDATA as $DATA): ?>
<?=$DATA[_FF_DATA_TITLE]?>: <?=$DATA[_FF_DATA_VALUE]?><br /><?=$NL ?>

if (strcasecmp($data[_FF_DATA_TITLE], "My field name" == 0)
$myfield_name = blah
if (strcasecmp($data[_FF_DATA_TITLE], "My field name" == 0)
$myfield_name2 = blah
if (strcasecmp($data[_FF_DATA_TITLE], "My field name" == 0)
$myfield_name3 = blah
if (strcasecmp($data[_FF_DATA_TITLE], "My field name" == 0)
$myfield_name4 = blah

<?php endforeach; ?>

and then formatting here

oh and id probably get rid of
<?=$DATA[_FF_DATA_TITLE]?>: <?=$DATA[_FF_DATA_VALUE]?><br />

so that they arent displayed before the formatting?
James Ashworth
Mediart Solutions
www.mediart.com.au

Re:Custom email noHanstifications howto 3 years, 3 months ago #2709

also i have tried some test send outs and the form is not using my custom email. below is the code in my timesheet.html.php file

<?php
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
?>

<?php if ($RECORD_ID != ''): ?>
<?=$PROCESS_RECORDSAVEDID?> <?=$RECORD_ID ?><?=$NL ?>
<?php endif; ?>

<?=$PROCESS_FORMID?>* <?=$FORM ?><?=$NL ?>
<?=$PROCESS_FORMTITLE ?>* <?=$TITLE ?><?=$NL ?>
<?=$PROCESS_FORMNAME ?>* <?=$NAME ?><?=$NL ?>
<?=$PROCESS_SUBMITTEDAT ?>* <?=$SUBMITTED ?><?=$NL ?>
<?=$PROCESS_SUBMITTERIP ?>* <?=$IP ?><?=$NL ?>
<?=$PROCESS_PROVIDER ?>* <?=$PROVIDER ?><?=$NL ?>
<?=$PROCESS_BROWSER ?>* <?=$BROWSER ?><?=$NL ?>
<?=$PROCESS_OPSYS ?>* <?=$OPSYS ?><?=$NL ?>

<?php foreach ($MAILDATA as $DATA): ?>
<?=$DATA[_FF_DATA_TITLE]?>* <?=$DATA[_FF_DATA_VALUE]?><br /><?=$NL ?>

<?php endforeach; ?>

TEST


the timesheet.html.php file is the only file in the directory administrator/components/com_facileforms/mailtpl
James Ashworth
Mediart Solutions
www.mediart.com.au

Re:Custom email noHanstifications howto 3 years, 3 months ago #2710

Yes that's how it would look and yes you would get rid of that line so it wouldn't show all the data.

blah there seems like it should be $data[_FF_DATA_VALUE], if the types match it should be ok if not some string conversion might be necessary.

Try renaming your timesheet... to mailtpl.html.php to see if it is used.

Mori
  • moriwenne
  • OFFLINE
  • Junior Boarder
  • Posts: 24
  • Karma: 5
Moderators: TheMuffinMan, ForumSupport
Time to create page: 0.47 seconds

About

Crosstec GmbH & Co. KG

Bergisch-Gladbacher-Str. 829

51069 Cologne, Germany