Extension talk:EmailForm

Latest comment: 9 years ago by 193.3.141.124 in topic FIXED: Change to after upgrade to PHP 5.3.29

Spam

edit

Hello,

I am using your extension and thank you for that work.

What I am witnessing is that I get a lot of s p a m, plenty of messages with external links....

I am using the extension recaptcha on the website but as no page is edited for the form, this is not trigerred.

Would you have any idea/suggestion about this?

Thanks and have a good day

Guy Contact form

I haven't had any spam through my site, but you aren't the only one to report this. Can you tell if the spam is being submitted through the form, or if the email address is being picked up through the MediaWiki:EmailForm page? I'm starting to think the address should be stored in the code instead.
EHartwell 20:05, 1 November 2007 (UTC)Reply
I agree storing in the code is probably a better solution however we need to make sure that it does not limit us to only one target mail address or we end up with Extension:ContactPage, maybe storing addresses in an array and then somehow selecting which one to use through the MediaWiki:EmailForm page, perhaps by providing the array index or something?
This extension works like charm. Only one question. When i fill out the form and send the mail, the sender is wwwrun@something.com (apache), but not the sender i typed in the form. Is it possible to change this?
--89.212.65.33 14:54, 24 January 2008 (UTC)Reply
I had a big problem with spam being sent via this contact form so I added checks for valid email address being used as 100% of the spams I was getting didn't even bother to enter anything looking remotely like an email address in the field. It only required detecting the address validity in send_email() and returning the error message text from render_email_field(), contact me if you're interested in my changes.
VZ 15:05, 23 March 2009 (UTC)Reply
Same here, I added reCaptcha to the extension, you may contact me as well. There's still a catch to it, but someone might be able to figure it out. Also, IMHO this extension would need a major re-factoring. The code is, to be honest, awful. --Clausekwis 14:53, 23 February 2010 (UTC)Reply

Feature Request: Captcha

edit

This extension really needs a built in captcha, because automated bots can easily send spam through this form. I've experienced this personally, since I tried it out on the Battlestar Wiki. -- Joe Beaudoin Jr. 17:08, 25 March 2008 (UTC)Reply

See above --Clausekwis 14:53, 23 February 2010 (UTC)Reply

Updated version

edit

From the main page, moved here:

I implemented this extension by the instructions above and my wiki page gave me a list of repeated errors like follows on the page where I placed the <emailform>:

PHP Notice: Undefined index: sendEmailForm in C:\Inetpub\wwwroot\mediawiki\extensions\emailform\EmailForm.php on line 49 

PHP Notice: Undefined offset: 0 in C:\Inetpub\wwwroot\mediawiki\extensions\emailform\EmailForm.php on line 58 

PHP Notice: Undefined offset: 1 in C:\Inetpub\wwwroot\mediawiki\extensions\emailform\EmailForm.php on line 127 

This drove me nuts, so I edited the EmailForm.php file so that these errors no longer display. I have verified that the EmailForm still functions perfectly. I also changed the subject line in the emails so that they only display the prefix and the name information instead of the entire content of the email.

All of my changes are very obvious and I left the original code in place behind comment symbols. I hope this helps you too!

I replaced this new version with the old version. Odessaukrain 20:01, 9 May 2008 (UTC)Reply

i cant see the hebrew emails

edit

when users write to me in hebrew i cant see the email.. can u help me?

Error on send

edit

Hi

I have somme pb with this extension :

The form is OK but the mail is not send and i have the following error message :

Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in D:\xampp\htdocs\mediawiki\extensions\EmailForm\EmailForm.php on line 223

Can somebody help me ? Thanks


Warnings and Blank Page after upgrading to 1.12.0

edit

I originally installed EmailForm in MediaWiki 1.9.3. When I upgraded to 1.12.0, pages with Email forms on them stopped displaying. I now get the white page. The apache error log looks like:

 [-timestamp-] [error] [client -IP-] PHP Notice:  Undefined index:  0 in /var/www/html/w/includes/Parser.php on line 3430
 [-timestamp-] [error] [client -IP-] PHP Notice:  Undefined index:  1 in /var/www/html/w/includes/Parser.php on line 3430
 [-timestamp-] [error] [client -IP-] PHP Notice:  Undefined index:  2 in /var/www/html/w/includes/Parser.php on line 3430

It turns out that on this particular page I have 3 section headings in the <emailform> and 0 section headings in the <emailform result> part.

The relevant code in Parser.php is:

  3375                  # Get all headlines for numbering them and adding funky stuff like [edit]
  3376                  # links - this is for later, but we need the number of headlines right now
  3377                  $matches = array();
  3378                  $numMatches = preg_match_all( '/<H(?P<level>[1-6])(?P<attrib>.*?'.'>)(?P<header>.*?)<\/H[1-6] *>/i', $text, $matches );

  3422                  foreach( $matches[3] as $headline ) {
  3423                          $isTemplate = false;
  3424                          $titleText = false;
  3425                          $sectionIndex = false;
  3426                          $numbering = '';
  3427                          $markerMatches = array();
  3428                          if (preg_match("/^$markerRegex/", $headline, $markerMatches)) {
  3429                                  $serial = $markerMatches[1];
  3430                                  list( $titleText, $sectionIndex ) = $this->mHeadings[$serial];

I'm guessing that the code is choking on the conditionally rendered section headings? I don't know enough about PHP, MediaWiki, or this extension to fix this, or even to definitively say that is the problem.

The problem can be worked around by editing the page (append ?action=edit to the URL) and taking out all section headers. Putting in __NOEDITSECTIONS__ does not do the trick.

Any help is appreciated.

Tnabtaf 16:51, 15 August 2008 (UTC)Reply

Page name with namespace prefix

edit

I can't seem to get page name prefixes to work (namespace): My Form works, but not HR:My Form.

Any way around this?

Great extension, by the way -- thanks!

"EmailForm is only active on protected pages" Message

edit

Hi,

I need to do a survey and I'm trying to use this extension. For some reason I am not able to see the form.

Although I have added the page details to MediaWiki:EMailForm, the form page only shows the message: "EmailForm is only active on protected pages."

I've tried everything I could. Does anybody has any idea?

Thanks.

Fix for 1.8+

edit

In order to work in newer versions of mediawiki I made the following changes. Commented lines are what used to be there.

 function render_wikitext($parser, $input) {
 #    $lparse = clone $parser;
 #    $output = $lparse->parse( $input, $parser->mTitle, $parser->mOptions, true, false );
     $output = $parser->recursiveTagParse( $input );
 #    return( $output->getText() );
     return( $output );
 }

LinkHolderArray problem since update on mediawiki 1.14

edit
Undefined property:  LinkHolderArray::$internals in path\includes\parser\LinkHolderArray.php in line 126

This is the message that i recieve in every page with a form after upgrading to mediawiki 1.14. With all previous versions (from 1.11 to 1.13 it worked perfectly). Can anyone help to find a quick solution?

thanks in advance
best regards
--TurboKanne 09:34, 17 February 2009 (UTC)Reply

Solution for the problem

edit

You should apply to the above article "Fix for 1.8+".

70.134.109.42 02:08, 28 June 2009 (UTC) I'm going to fix the extension page.Reply

Charset - how?

edit

How i can add "Content-type: text/plain; charset=ХХХ" to final message? Some mailservers do not understand encoding correct... How can I set the character set of letters by hand? Thanks for your reply --81.200.28.116 11:06, 28 February 2009 (UTC)Reply

Solution: Add additional $headers info to the mail() function, for example:

    #######################
    ##### Custom Code #####
    #######################

    $subject = $settings['prefix'] ." ". $name;   #This reduces the subject line to just the prefix and the name

    // Set HTML Mail Header, see http://de.php.net/manual/en/function.mail.php
    $headers  = "MIME-Version: 1.0" . "\r\n";
    $headers .= "Content-type: text/plain; charset=\"utf-8\"" . "\r\n";

    ##############################
    ##### End of Custom Code #####
    ##############################

    $sent = mail ( $settings['to'], $subject, "From: " . $from . "\n" . $message, $headers);

--Ralfk 17:08, 11 October 2011 (UTC)Reply

Form

edit

How do I make the form so that when someone click 'send comments' without entering anything it says:

You have not filled in the following fields:

  • Topic
  • Name
  • Email
  • Message

86.136.108.50 14:32, 14 March 2009 (UTC)Reply

FatalError

edit

Hello. I have an error on a pages with email form after i have updated mediawiki to 1.14 version:

 Fatal error: Unsupported operand types in /srv/www/w/includes/parser/LinkHolderArray.php on line 33

How can i fix it? Thanks. --79.142.85.9 20:05, 9 June 2009 (UTC)Reply

Fatal error: Unsupported operand types in /home/.marabel/protofilm/protofilm.net/includes/parser/LinkHolderArray.php on line 33

edit

I am receiving the same error as the inquiry above. I'm using version 1.15. Any help is appreciated.

thanks

--Kentongrey 14:38, 7 July 2009 (UTC)Reply

bigger rows and cols?

edit

How can I make the rows and cols bigger?

textarea: name="description" prompt="Problem description" rows="300" cols="300" Don't work

andrea 80.218.141.182 20:05, 21 October 2009 (UTC)Reply

Problems after upgrade to PHP 5.3

edit

I am getting this error after my provider upgraded PHP to 5.3

Parameter 3 to renderEmailForm() expected to be a reference, value given in /customers/vrold-bakker.dk/vrold-bakker.dk/httpd.www/includes/Parser.php on line 626


Please help

Thanks

--Tomas 15:32, 12 February 2010 (UTC)Reply

RESOLVED

function renderEmailForm( $input, $argv, &$parser ) {

has to be changed to

function renderEmailForm( $input, $argv, $parser ) {

--Tomas Jensen 09:10, 23 February 2010 (UTC)Reply

I tried function renderEmailForm( $input, $argv, $parser ) { and it still did not work. All I get in both is a blank page.

Please sign your posts. Ok?
add these lines in the top off LocalSettings.php to enable php debugging.

error_reporting(E_ALL);
ini_set("display_errors", 1);

And read How to debug

--Tomas Jensen 10:20, 18 March 2010 (UTC)Reply

Setting Maxlength on Form Fields?

edit

I want to set a maxlength on a form field but am having trouble figuring out the syntax. For example, <emailform comments=140> simply sets the size of the space, but it doesn't stop anyone from typing in more than 140 characters. How would I get a EmailForm translation of <input name="comment" type="text" id="tweet" maxlength="140" size="140" /> ? Any help would be appreciated.

March 15, 2010


Setting email adresses

edit

Hello,

I see here that MediaWiki:EmailForm don't exist anymore. Where i should put the email of the user that will receive the message?


June 6, 2010

Doesn't work with MediaWiki 1.15.3

edit

In MediaWiki:EmailForm I entered the 3 line format: FormPage | admin@mysite.com | (From Contact Form)

On "FormPage" I can fill out the form but when I click send I get this message:

EmailForm: MediaWiki:EmailForm has no settings for FormPage --Holygamer 20:54, 22 September 2010 (UTC)Reply


I had a similar issue. For others experiencing this, you are probably using the wrong URL to enter the data, as I was. Make sure you are using:

http://wiki/index.php?title=MediaWiki:EmailForm

AND NOT

http://wiki/index.php?MediaWiki:EmailForm

Note the "title=" in the url. The former is the correct config page. The latter is just a plain page. Also, if you want it to email multiple addresses, use a comma to separate them, i.e.

All Hands Questions | johndoe@here.com, janedoe@here.com | (From All Hands Question page)

edit

I'm attempting to incorporate a drop down list of strings within my e-mail form to allow users to select from a list of values, which would then be passed to an emailform attribute. For example, a drop down menu for <emailform fruit> would be availabe, and the user would have the option of selecting one of the following: apple, orange, mango, banana, etc. Anyone know of a method by which I could accomplish this? Thanks --Enterprise user 20:55, 3 February 2011 (UTC)Reply

Hi,

you can user normale raw html (if allowed) like:

<html>
<select id="color" name="color" >
<option value="red">Red</option>
<option value="blue">Blue</option>
</select>
</html>

greetz VanGore 20:22, 27 September 2011 (UTC)Reply

Hidden fields not parsing

edit

I can't seem to get the extension to parse the hidden fields in my form. For example, I have the following two hidden fields:

  • <emailform name={{#email:#_User}} />
  • <emailform version=unspecified />

The first one is wiki text which calls the e-mail of the currently active user. The second one is just an field that I want to assign a constant value of "unspecified". When submitting my form, I find the text fields which require user input are parsed correctly, and render in the emailed form. The above two hidden fields are not parsed, and do not render in the emailed form. The emailed form resembles something like this:


To: user@domain.com
Subject: My Subject

From: My Subject
textfield1: foo
textfield2: bin
textfield2: baz

Neither the name/from, or version fields are rendered. Any thoughts on what the issue is? --Enterprise user 17:50, 15 February 2011 (UTC)Reply

Patch to set "From"

edit

To set the e-mail sender (From:) as it is filled in the form:

Change

$sent = mail ( $settings['to'], $subject, "From: " . $from . "\n" . $message);

to

$sent = mail ( $settings['to'], $subject, "From: " . $from . "\n" . $message, 'From: '.$from);

--Planetenxin 18:25, 12 July 2011 (UTC)Reply

This extension does not work in Mediawiki 1.16

edit

I have tried contacting the author many times via his contact form but to no avail. The extension was successfully installed and a form can be created but it will not send mail. Mediawiki and other extensions send emails fine, for example on new signups etc......This extension does not. I have checked and Sendmail is installed and working fine. The extension has also be setup and configured correctly and according to installation guidance.

Has anybody else had a problem with EmailForm not sending? If so what was the fix?

Thanks in advance,

Adam

Changes for 1.18

edit

As with mediawiki 1.18 this extension doesn't work. changing action=purge to action=view does make it work again.

In more detail, change this line:

. '<input type="hidden" name="action" value="purge" />'

to this:

. '<input type="hidden" name="action" value="view" />'

and this beautiful extension will work with mediawiki 1.18

Mail Problem -- one solution

edit

The extension appeared to be working correctly but it wasn't sending mail. The Wiki was able to send mail from other functions but the EmailForm merely rendered the success message without sending mail.

SOLUTION: I modified the EmailForm.php line

$sent = mail ( $settings['to'], $subject, "From: " . $from . "\n" . $message);

to this:

$sent = mail ( $settings['to'], $subject, "From: " . $from . "\n" . $message, $xheaders);

where $xheaders is defined as:

$xheaders = "From: " . $from  . " <" . $from  . ">\n";
$xheaders .= "X-Sender: <" . $from . ">\n";
$xheaders .= "X-Mailer: PHP\n";
$xheaders .= "X-Priority: 6\n";

It may be necessary to experiment with the headers. This worked for me.

Nice extension--thanks.

RKH

Non empty fields

edit

Hi.

Great extension :) Is there any way to force a field to be filled in i.e. not allowed to be submitted empty?

I also notice that it allows people to send completely empty forms with no fields filled in. Could a check be added to ensure at least one field has been populated e.g. Email address?

Thanks! --Mitchelln (talk) 10:07, 15 January 2014 (UTC)Reply

Add multiple recipients

edit

Hi.

How to I specify multiple recipients for a form? I've tried:

Feedback | testing@hols.gov.uk,info@testing.org.uk,joe@bloggs.co.uk| Site Feedback -

But the email only gets sent to the first recipient.

Any ideas?

Thanks.

--Mitchelln (talk) 13:47, 10 September 2014 (UTC)Reply

FIXED: Change to after upgrade to PHP 5.3.29

edit
# Load the email form settings from a special page MediaWiki:EmailForm
# $pagetitle is the name of the page with the form on it
function get_MediaWikiEmailForm_settings ( $pagetitle ) {
    $value = Title::newFromText('MediaWiki:' . EMAILFORM_NAME);
    $settingpage= new Article( $value );

--193.3.141.124 11:37, 3 March 2015 (UTC)Reply

Return to "EmailForm" page.