Summary: talk page of Fox Notify

Comments and Discussion about FoxNotify

Please Leave latest message at the top please!

I get a php warning about FoxNotifyUpdate on line 92 missing the 4th parameter, $targ, which you recently added. I use fox.php and foxnotify.php only, no other foxes. I'm thinking that perphaps it's one of the calls to register_shutdown_function(FoxNotify,...), which all seem to fill in three arguments only, never four. I could be wrong, what do you think? SteP November 17, 2015.

Thanks, I fixed what you pointed out. please test the new version and let me know if this is working okay! HansB November 17, 2015, at 09:33 AM

Thanks Hans. I think it's OK now. SteP

Each time an email is sent I get the following error message:

Warning: Illegal string offset 'taridx' in ".../fox.php" on line 1216
Warning: Illegal string offset 'taridx' in ".../fox.php" on line 1216
Warning: Cannot modify header information - headers already sent in ".../pmwiki.php" on line 1216

Any Ideas? Klonk November 25, 2013, at 03:12 AM

I don't know what is going on. The line number quoted suggest to me that you are not using the latest version of fox.php. You could try the latest versions of fox.php and foxnotify.php and report back if tha thelped or not. HansB November 25, 2013, at 03:40 AM

German characters (öäüß) are not included in FoxNotify emails

I use FoxNotify to send emails. Unfortunately it does not send German umlauts at all. What to do?

[(approve links) edit diff]

Does work for me when they are part of the message text. - HansB June 08, 2010, at 04:06 AM

$WikiTitle in subject

In the sample template within the [#subject] Section the $WikiTitle is not resolved. have not found out yet why. In the other sections everything is fine. Any ideas? Klonk March 07, 2010, at 12:24 PM

I hope I've fixed the issue with the latest release of foxnotify.php. - HansB March 10, 2010, at 04:46 AM

Changing the FROM: address in FoxNotify/foxmail

SteP January 30, 2010: FoxNotify can be used to replace the mail form capability that PmForm provides. One issue to overcome is to find a way to set the FROM header after posting the mail form, that is after a sender has entered her address. Currently, FoxNotify allows setting FROM via $FoxNotifyFrom before posting. Here is a hack that allows a fox filter function to add/change the FROM header. Add this code to function FoxNotifyUpdate right before the line that reads $headers = FmtPageName($FoxNotifyHeaders, $pagename);:

if ($_POST['FoxNotifyFrom']>'')
   $FoxNotifyHeaders = 'From: '.$_POST['FoxNotifyFrom']."\r\n".preg_replace('/^From:.*\\n/','',$FoxNotifyHeaders);

Then set the new FROM in your fox filter function this way:

$_POST['FoxNotifyFrom'] = $fields['FormFromField']; # requires modded foxnotify.php recipe

The email FROM header cannot be modified on purpose via a form, as this could be exploited to use FoxNotify as an email spamming tool. HansB

Where to put a conditional?

Hi Hans,

The ...

$group = PageVar($pagename, '$Group');
if ($group!='Test') $EnableFoxNotifyHTMLEmail = true;

that you advised in the earlier post works very well thank you!. I didn't know how to do that in config.php. I now have a follow up question. I have some conditional markup in the template (I'm unsure if this is the best place to put it!). The conditional works as expected in HTML format. However in plain text the whole text is displayed. For example if {$$Country} is set to UK from the form input, and I have this in the template:

(:if equal {$$Country} "US":)<SUN_SUB_TASK_TYPE>US</SUN_SUB_TASK_TYPE>
(:elseif equal {$$Country} "CA":)<SUN_SUB_TASK_TYPE>Canada</SUN_SUB_TASK_TYPE>

Then when HTML format is selected the e-mail correctly displays:


However when plain text is selected the e-mail displays the whole line but includes the variable:

(:elseif equal UK "CA":)<SUN_SUB_TASK_TYPE>Canada</SUN_SUB_TASK_TYPE>

Am I putting the conditional in the right place - i.e. in the template, or is there a more effective way to get the desired result?



I have not looked into the question of using conditional markup within an email template. I know that these templates behave a bit different from standard templates, that variables are evaluated differently. So at this point the only advise I can give is this: avoid conditional markup in email templates, and always use different templates for plain text emails and for HTML formatted emails. If different input conditions shall result in different email output (apart from different input values), try to set your form up so it will use a different email template for each condition, or perhaps try that the input variable is processed when the form submits, perhaps by using variable replacements within hidden fields, or a Fox filter function. - Anyway, that's it till I have a clearer idea how conditional markup plays in these templates. HansB February 19, 2009, at 03:46 AM

Mixing HTML and Plain Text Formats in one wiki.

Hi Hans, can you advise how I could go about using Foxnotify to send plain or HTML e-mails by Group setup? I have this in my config.php

$EnableFoxNotifyHTMLEmail = true; ^M
include_once("$FarmD/cookbook/fox/foxnotify.php"); ^M

My template looks like this:

{$$Country} - Global Warranty Registration - {$$Companyname}
(:if equal {$$Country} "US":)<SUN_SUB_TASK_TYPE>US</SUN_SUB_TASK_TYPE>
(:elseif equal {$$Country} "CA":)<SUN_SUB_TASK_TYPE>Canada</SUN_SUB_TASK_TYPE>
<SUN_NOTES>list of all fields labels and values from the webform</SUN_NOTES> 

For one type of e-mail sending - I need the output to be in plain text only as the e-mail is sent to another system for processing. If I put this $EnableFoxNotifyHTMLEmail = false; into a Test.php file within /local for the Test group in an attempt to only set Plain text e-mail for the specific Test group the e-mail is garbled/corrupted.

Is it possible to have both plain and html e-mails foxnotify running at the same time?


Instead of a local/Test.php file you could try a conditional in config.php which sets $EnableFoxNotifyHTMLEmail = true; for all groups except the Test group:

$group = PageVar($pagename, '$Group');
if ($group!='Test') $EnableFoxNotifyHTMLEmail = true;
HansB February 18, 2009, at 04:12 PM

Email address in form - cont'd

Sorry - I didn't make this comment as clear as it should be, or else I don't fully understand the reply. In reality I have a small group of people who receive e-mails containing foxform submissions from a much larger team. The user submitting the work wants an e-mail record as a proof of form submission. So I am looking for a way where the small group is always emailed - but the wiki also sends the contents to the form user/submitter.

Hence I was trying to add the user's e-mail address into the NotifyList page only for their own form entry - but I can't get this to work. Perhaps I'm going about this the wrong way.


Still trying to get the ability for the user (with edit priv) to add his/her e-maill address in the form and the form be sent to them as well as those in the notify list.

I tried putting{$$requestoremailaddress} #=body in the NotifyList template where requestoremailladdress is a input PTV in the foxform but it didn't work. Is it possible to do this - via this method?

I do not think it is possible. FoxNotify and Notify both take the email addresses from a wiki page, the NotifyList, in FoxNotify's case this page is specified with the target parameter, or the foxnotify parameter. There is no provision to inject a specific email address as a 'Send To' into the form. I will try to see if there is an easy way to add this to the script, but no promises! - HansB January 22, 2009, at 04:45 AM

Using PTVs or input variables in the email subject

Is there some way of being able to put a PTV into the subject line of the foxnotify e-mail: i.e.

New Billing Request from {$$RequestorName}

Download the latest foxnotify.phpΔ, then add a hidden input field to pick up a PTV, like

(:input hidden RequestorName '{$PageName$:RequestorName}':)

which passes on the PTV named 'RequestorName' from page 'PageName' as a replacement variable.
Then use the template as above. - HansB September 29, 2008, at 11:50 AM

use of single quotes in message strings

I am using the following French foxmessage in my foxform:

foxcheckmsg="Le Formulaire n'est pas correctement rempli ! Il n'a été validé. Merci de corriger et de re-soumettre."

Unfortunately the ' characters seem to be interpreted as end of string - so that the message on the screen is shown only as..

Is there a way around this. I tried various combinations but none worked for me.

use &#39; instead of '

Put a from e-mail adress in the form

in config.php

 $FoxNotifyFrom = $_POST['from'];

in form

 (:input hidden from value='' :)

e-mail address in form field?

Is it possible to have an e-mail address - entered within the input form - to be then used by Foxnotify? What I'm wanting is for the submitter to complete the form - it then gets sent via e-mail to the correct team AND at the same time, the submitter gets a CC: of the form for their own records - also by e-mail. So the submitter would complete the details required for the form, add their own e-mail addres and a copy of the form is sent to them.

Foxnotify does not allow this for the same reasons Notify does not allow it: it could lead to abuse, posters could use a form to send content to email addresses of their choosing, i.e. it could be used for spamming. Therefor all email adresses must be on some specific list. - HansB

I understnad the intent, however my wiki is behind a Corporate firewall and the users follow the correct etiquette. What my users are used to having is some kind of "reciept" that shows they did indeed submit the form. Else they have no proof when they wish to follow up if no response is received. Today this is most often done by the form BCC'ing the individual. I can make the form only allow a e-mail addresses - so I would like the ability for the user to get a copy some how. An alternative is to write the form to apage - but that would be a heck of a lot of pages - that are in fact just e-mail templates - lying around on the wiki.

allowing email addresses as targets under special conditions is quite difficult to implemenmt as it requires some rather complex code changes both in fox.php and foxnotify.php. Not sure if or when i may be getting around doing this. HansB September 23, 2008, at 03:16 AM

Users with edit-priviledges maintaining FoxNotify settings

Scenario: users have their own Groups, which only they maintain with their own password. They all have a $Group/$Group-Notify page where they can add and delete their email address for notification purposes when a visitor makes a comment within their group.
Problem I was having: Captcha was preventing the user from deleting their email address on FoxNotifyLists. Even though the group-editor was able to successfully add an email without any Captcha present (it's turned off if you have edit-priviledges), I believe Captcha was turning back on when attempting to reach over and access FoxNotifyLists.
Current Settings that "solved" this problem:

if (CondAuth($pagename,'admin')) {
$FoxPagePermissions['*.*'] = 'all'; 
elseif (CondAuth($pagename,'edit')) {
$FoxPagePermissions['*.*'] = 'add,delete'; 
# where $group is defined in config.php as PageVar($pagename,'$Group');
$FoxPagePermissions['$group.*'] = 'all';
elseif (CondAuth($pagename,'read')) {
$FoxPagePermissions['*.*'] = 'add'; 
$FoxPagePermissions['FoxNotifyLists.*'] = 'add,delete'; 
# this latter part is necessary to delete emails from FoxNotifyLists
# because the user's Auth is only 'read' for this area...


## was causing -Notify pages to not allow users to 'delete' email entries
$EnablePostCaptchaRequired = 1; # turn captcha on by default
# permit those logged in with 'edit' priv's to have captcha turned OFF
if (CondAuth($pagename,'edit') || $action=='foxdelete') {
$EnablePostCaptchaRequired = 0; 
# must be turned off here, or else won't let user delete pages

this part under CondAuth=='read' seems iffy:

$FoxPagePermissions['FoxNotifyLists.*'] = 'add,delete';

... potentially a security risk, right? but the only way i could get it to work...

anyhow, it seems to work now, and i think setting other precautions (basic read/display priviledges) on certain pages with fox forms will most likely [hopefully] do the trick...

overtones99 July 10, 2008, at 08:23 PM

FoxNotify email attachment

Is it possible to have FoxNotify send a file as an attachment.?? Graham April 1 2008
It is not possible a far as I know, and I think it would be quite difficult to implement, if possible at all. HansB

FoxNotify email footer

Hi - how would i go about sticking a footer into my notification email created by Fox? I'd like to have a line added to emails reminding recipients of unsubscription options, and maybe even some website tagline stuff at the end... however, right now it appears adding this info to Email Item Formats (say, #default), would result in the footer being repeated if there are multiple posts being reported, right? Is there an easy way to mod FoxNotify so that a footer is amended if supplied? Thanks! overtones99 March 28, 2008, at 09:29 PM

I think it may work if you change $FoxNotifyBodyFmt to include a footer variable. Try this in config:

# change body format to include footer var:
$FoxNotifyBodyFmt = 
# add new footer var:
$FoxNotifyBodyFooterFmt = "my footer stuff....";

To make this variable configurable via the FoxNotifyTemplates page would need some alterations of the foxnotify.php script. HansB March 29, 2008, at 03:37 AM

Just in case others might like to see, i altered my version of foxnotify.php in the following places in order to have it add footers:

SDV($FoxNotifyBodyFooterFmt, "You have received this email because you're signed up 
    to receive notifications from \$WikiTitle");  // <- new
   ."\$FoxNotifyBodyFooterFmt\n");     // <- new

then later, adding a global variable for $FoxNotifyBodyFooterFmt:

function FoxNotifyUpdate($pagename, $dir='') {
  global $FoxNotifyList, $FoxNotifyLists, $FoxGeneralNotifyList, $FoxNotifyFile, $IsPagePosted,
    $FmtV, $FoxNotifyTimeFmt, $FoxNotifyItemFmt, $FoxNotifyTemplatePageFmt, $FoxNotifyListsGroup,
    $FoxNotifySquelch, $FoxNotifyDelay, $Now, $SearchPatterns, $WikiTitle, $FoxRecipient,
    $FoxNotifySubjectFmt, $FoxNotifyBodyFmt, $FoxNotifyBodyHeadingFmt, 
        /* new => */ 
    $FoxNotifyBodyFooterFmt, $FoxNotifyHeaders, $FoxNotifyParameters;

and then amending in one more spot:

if(PageExists($tpname)) {
   $tpage = ReadPage($tpname, READPAGE_CURRENT);
   $tsubject = trim(TextSection($tpage['text'], '#subject'),"\r\n");
   $tbodyheading = trim(TextSection($tpage['text'], '#heading'),"\r\n");
   $tbodyfooter = trim(TextSection($tpage['text'], '#footer'),"\r\n");   // <- new
if(!$tsubject) $tsubject = $FoxNotifySubjectFmt;
$subject = FmtPageName($tsubject, $pagename);
if($tbodyheading) $FoxNotifyBodyHeadingFmt = $tbodyheading;
if($tbodyfooter) $FoxNotifyBodyFooterFmt = $tbodyfooter;   // <- new

this works great!! overtones99 March 30, 2008, at 06:43 PM

FoxNotify form: odd characters >>> & <<<

Hi again, Just wondering what <<< and >>> are supposed to do in the code on FoxNotify? I have the feeling it's supposed to be for a newline [[<<]], right? thanks! overtones99 March 24, 2008, at 11:21 PM

It is supposed to say that the code line is continuing, i.e. the next line in the example belong to the previous line. It is NOT part of the code! sorry if that caused confusion! Sometimes source code has very long lines, and posting them to display as source code can destroy the skin layout. HansB

emails in HTML?

Could Foxnotify have the means to format the mail so that an e-mail reader (i.e. Thunderbird) could display the mail as html rather than plain text? Graham 2008-03-26

it may be possible by adding or changing various FoxNotify config variables, in order to add the necessary declarations for coding, mime-type, and tags. But I have not tried. HansB

The following can perhaps give you some ideas. But note that you can't use the FoxNotifyTemplates for inserting HTML tags, unless you specifically allow certain html tags for it (possibly).

add in config.php (and don't use/remove/rename FoxNotifyTemplates)

//the next makes the email into HTML formatted email
$FoxNotifyHeaders = 'MIME-Version: 1.0' . "\r\n"
        .'Content-type: text/html; charset=iso-8859-1' . "\r\n";

//try adding some HTML tags
//heading in the email body:
$FoxNotifyBodyHeadingFmt = "<h3>Recent \$WikiTitle posts: </h3>\n";

//each notify item:
$FoxNotifyItemFmt = "<a href='$ScriptUrl/{\$FullName}'>$ScriptUrl/{\$FullName}</a>"
             ." . . . $PostTime by <b>{$LastModifiedBy}</b><br /> \n";

//adding a footer
$FoxNotifyFooterFmt = "<br /><i>mail sent by pmwiki notification service</i>";  

$FoxNotifyBodyFmt = 

I have two forms in my site. How can I specify two different "subject" in the "FoxNotifyTemplates" page? Pierre 2008-02-12

I have no easy solution for this. Presently you can specify different template formats for the email body only. Maybe i can change that in future to allow specifying formats for header and subject. Right now you can try to load a different FoxNotifyTemplate page for each of your form pages, using conditionals in config.php to set $FoxNotifyTemplatePageFmt, somthing like this:

$name = PageVar($pagename, '$FullName');
if ($name=='SomeGroup.SomePageA')
   $FoxNotifyTemplatePageFmt = ""$FoxNotifyListsGroup.FoxNotifyTemplatesA";
if ($name=='SomeGroup.SomePageB')
   $FoxNotifyTemplatePageFmt = ""$FoxNotifyListsGroup.FoxNotifyTemplatesB";

HansB February 13, 2008, at 05:59 AM

Talk page for the FoxNotify recipe (users?).