This is GPL, only it seems odd to include a license in a programm that has twice the size of the license. Modifications to work with PmWiki 2.0, Copyright (c) 2005 by Patrick R. Michaud Modifications to work with the MyWikiFriends.php cookbook module, anti-copyright 2005 by Jeffrey W Barke Revision 1.1 20050802 Jeffrey W Barke Changed all variables and functions to "e"mailform. Revision 1.2 20060521 Nils Knappmeier Changed form-method to "post" in order to work correctly with Safari Modifications to work as a subscription form copyleft 2007 by Daniel Roesler Added feature: separate unsubscribe destination email varible copyleft 2008 by Daniel Roesler Added internationalization 20160818 by Franz Frese There is a lookup in the language XLPages for EMLFsuccess, ..., Submit. see XLSDV */ $RecipeInfo['MailListForm']['Version'] = '2016-08-18'; XLSDV('en', array( 'EMLFsuccess' => 'Message has been sent successfully.', 'EMLFfailure' => 'Message could not be sent.', 'EMLFerror' => 'An error has occurred.', 'Your Name' => 'Your Name', 'Your Email' => 'Your Email', 'Subscribe' => 'Subscribe', 'Unsubscribe' => 'Unsubscribe', 'EnterName' => 'Please enter your name.', 'EnterEMail' => 'Please enter your email address.', 'EnterWhat' => 'Do you want to subscribe or unsubscribe?', 'Submit' => 'Submit')); $r = @$_REQUEST['emaillistform']; $EMailListFormResult = FmtPageName("$r", $pagename); # This is the default form, as a table. The '$1' is replaced with # the word that comes after the mailform: markup -- the rest are # straightforward $...Fmt substitutions. SDV($EMailListFormFmt,"
\$EMailListFormResult
$[Your Name]:
$[Your Email]:
$[Subscribe]:
$[Unsubscribe]:
"); # This defines the mailform: markup -- it's just a straight text # substitution. Markup('emaillistform', '>links', '/\\bemaillistform:(\\w+)/', FmtPageName($EMailListFormFmt, $pagename)); # These define what happens after someone has submitted a message. # The variables are the header and footer for the email message, # while HandleMailListForm sends the message according to the # value of 'address' in the request. $HandleActions['emaillistform'] = 'HandleEMailListForm'; function HandleEMailListForm($pagename) { global $EMailListFormAddresses, $EMailListFormAddressesUnSubscribe, $EMailListFormSubscribeText, $EMailListFormUnSubscribeText, $EMailListFormSubscribeSubject, $EMailListFormUnSubscribeSubject, $EMailListFormName, $EMailListFormFrom; # Retrieve the form user information $EMailListFormName = $_REQUEST['emaillistform_name']; $EMailListFormFrom = $_REQUEST['emaillistform_sender']; $subscribe = $_REQUEST['emaillistform_subscribe']; # Retrieve the mailing details from the config file $to_sub = $EMailListFormAddresses[$_REQUEST['emaillistform_address']]; $text_sub = FmtPageName($EMailListFormSubscribeText[$_REQUEST['emaillistform_address']],$pagename); $text_unsub = FmtPageName($EMailListFormUnSubscribeText[$_REQUEST['emaillistform_address']],$pagename); $subject_sub = FmtPageName($EMailListFormSubscribeSubject[$_REQUEST['emaillistform_address']],$pagename); $subject_unsub = FmtPageName($EMailListFormUnSubscribeSubject[$_REQUEST['emaillistform_address']],$pagename); # Feature added so unsubscribe messages could be sent to # separate address defined in config file. A separate # section was written to ensure backwards compatibility # with earlier versions. If config file does not have the # unsubscribe address variable, this uses the subscribe # address by default. if($EMailListFormAddressesUnSubscribe[$_REQUEST['emaillistform_address']]) { $to_unsub = $EMailListFormAddressesUnSubscribe[$_REQUEST['emaillistform_address']];} else { $to_unsub = $to_sub; } # Decides whether user is subscribing or unsubscribing if ($subscribe == 'subscribe') { $to=$to_sub; $subject=$subject_sub; $text=$text_sub; $subscribe = XL('Subscribe'); } else if ($subscribe == 'unsubscribe') { $to=$to_unsub; $subject=$subject_unsub; $text=$text_unsub; $subscribe = XL('Unsubscribe'); } # Sends the email to the appropriate address if (!$EMailListFormName) $msg = XL('EnterName'); else if (!$EMailListFormFrom) $msg = XL('EnterEMail'); else if (!$subscribe) $msg = XL('EnterWhat'); else if (!$to) $msg = XL('EMLFerror'); else if (mail($to, $subject, $text, "From: $EMailListFormFrom")) $msg = $EMailListFormName.' ('.$EMailListFormFrom.') '.$subscribe.': '.XL('EMLFsuccess'); else $msg = XL('EMLFfailure'); # Reloads the page with the success/failure message header("Location: $ScriptUrl?pagename=$pagename&emaillistform=$msg"); } ?>