Marcus Denning, 20160215-14:55
The look of the form lines is a little out of bounds to the right. This is the change I made to clean up the right border.

    form.emailform fieldset
    border:2px dotted #b48181;

Once this change is made, the textarea will be within the confines of the dotted borderline which has been defined.
I might also suggest changing the code to make the form input areas more user-configurable in labels, sizes, etc. Thanks!

Hi, I can install emailform without a problem; it tests out after installation. Then, as soon as I close out the computer and reopen, it is broken. What gives? June 24, 2011

  • There appears to be a minor bug in in the code carrying the version date SDV($RecipeInfo['EMailForm']['Version'], '2007-11-10');

The 'if' statement around line 130, which should insert the default value to be used if the form user does not include their email address, appears after the string that would use it, while it should appear before, so that the value is set before it is used. I spent an hour troubleshooting a new install thinking it was a config error, before checking inside the recipe code and spotting this. These are the line concerned:

 $headers .= "From: $from\r\n";
 if (!$from) $from=$EMailFormDefaultSender;

Once their order was reversed, the default email address was inserted into the message and appeared as expected when the sender declined to enter their email address on the comment form. Des September 17, 2008, at 10:49 AM

  • In addition to what is written below I wonder, if it would be possible, to write the Variables


in an encrypted form in the pages source-code, so it would not so easy, for other people to get it, also, in times with massive spam-problems, it might be a good idea, if there could be a little field with some graphical letter, that some has to read and fill in another field, to provide automatic sending of mails.

Thanks Gerald

  • The web page reports the version information as: Version: 1.5.3 (Release date: 2007-11-10) but the emailform.php contained within the zip file reports the Version date as:
SDV($RecipeInfo['EMailForm']['Version'], '2007-08-04');

This causes analyze to always report that the cookbook is out of date.

  • It works just great, thanks! A suggestion might to have the script check the "message" body for content and display an error if it's empty; otherwise some anoying person could flood your mailbox with empty messages just by clicking on the Send button over and over again.
    Added, 23-Jan-2005. --Pm
  • I would also like a check, but with a warning for empty address field --Blader_se
  • Possible Issue with I18n translation, you have to load the MailForm after the Localisation Section in config.php Isidor
  • This script seems to conflict with the TellAFriend script. If I try to put both on my Wiki, I get the error message:
    Fatal error: Cannot redeclare handlemailform()
    (previously declared in /cookbook/tellafriend.php:80) in /cookbook/mailform.php on line 61
Any ideas why? IDB
The TellAFriend script is also defining a function called HandleMailForm(), and PHP won't let you do that. The author of the TellAFriend script should probably rename the function to something else that won't conflict. --Pm
Thanks, Pm. I've emailed Jeff, author of TellAFriend, regarding this. IDB
I believe I'm the Jeff you're referring to, but I don't remember receiving that email. Regardless, prior to reading these comments, I downloaded the script and noticed the same conflict with TellAFriend, so I updated the script as emailform.phpΔ and uploaded it here. It appears to be working - a demo version can be seen at
  • IDB I have a couple of suggestions for this useful script:
    • Move the Send button to below the Message textarea -- if you tab between fields, the order is Address, Send, Subject, Message. I can foresee some of my users entering their email address and then hitting Send by mistake -- before they can enter a message!
    • Email address validation would be useful (ie, just check that the text entered into the email field is in the correct format for an email)
    • It would be useful to be able to specify that the user enters data in some (if not all) of the fields. Is this possible?
    • Once the message has been sent, the script displays the sentence, "Message has been sent successfully". BUT it also continues to display the mailform. Could the script be programmed to not display the mailform if the message was successfully sent? (I am not a programmer, and my knowledge of PHP is rudimentary at best, so I don't know if what I suggest is possible.)
  • Armin It would be nice if I could add multiple email-adresses into one $MailFormAddresses, as e.g.
    • $MailFormAddresses['Pm'] = '', '', '';
      *Any chance?
    Pm: Sure, just separate the addresses by commas:
            $MailFormAddresses['Pm'] = 
Armin: I was so close! Thank's for your help.
  • I got an error while using this mailform: "Warning: mail(): SMTP server response: 451...." and another error saying it couldn't change the header. I searched on this 451 error and found out that you have to change "\n" to "\r\n" in mailform.php. Then it worked great!!!
  • When I use mailform in my pmWiki 2, either, if it is a single installation or a WikiFarm (then I includet mailform.php in the farmconfic.php), got my testmails around 17 times and an error message from my Browser, that the connection was repeated to often during opening of http://domain/wikifield/index.php and that this could happen if the forwarding is incorrect. When I tried another php-script in an standalone index.php in the root of my webspace, everything was ok

""UPDATE"" I got the same error-message, when I tried the mailform above.

  • cvokk I have edited mailform.php (the one, that is compactible with TellAFriend): edited_mailform.phpΔ, added features: possibility to decide, whether the email is required or not (by setting variable $RequireEmail - see source), regular expression which checks if email is valid. Rename it after downloading or use include_once('cookbook/edited_mailform.php'); The rest stays the same.
    • I am getting following Fatal error: Call to undefined function: isvalidmail() in /path/to/pmwiki215/cookbook/edited_mailform.php on line 95. Any experiences or solutions?
    • Solution: change the function name on line 95 to IsValidEMail [by aappii].
  • another improvement could be preserving the text in case that error occured
  • I have adjusted the original mailform quite thoroughly, because I needed to make a function to send a specific set of information - i.e. make a "become member"-form for an organisation. That all works very well. However, I now need to add a mailform more like the mailform.php. So, I've tried renaming that to contactform.php, updating all occurences of the word mail to contact (except in the markup line, which therefore shows up as:
Markup('contactform', '>links', 
  FmtPageName($ContactFormFmt, $pagename));

I've added: include_once('cookbook/contactform.php');

    $ContactFormAddresses['Kontakt'] = '';
    $ContactFormDefaultSender = '';

To the config.php

I try to call this new function with contactform:Kontakt, but when I put it on the screen it shows up as excactly contactform:Kontakt. I am completely new to PHP, and I guess I shouldn't be messing with code before I know a bit more about what I do, however, my original messing about turned out just fine. So, I'm sure there must be a simple solution out of this and that I've just screwed something very basic up.

Thanks for a great program and some very nice add-ons btw.

EDIT: Disregard this dumb question. I just had to upgrade the last occurence of mail too. Guess the b confused me, since I have no idea why it is there...
I just tried using this and have everything set properly, but only get the message: "Mail could not be sent". Any suggestions how to troubleshoot this? Caveman

Obsolete Feedback

I have just installed mailform.php

When I test it it I get an errormessage in my browser Safari, (se below) and the same mail is sent 17 times. Thanks for any tips.


Error message in Safari (sorry for the Swedish). It says that too many redirections occurred Safari kan inte öppna sidan. /Can't open the page/ Alltför många omdirigeringar inträffade när programmet försökte öppna ”” (hyper long url cropped).

 8 identical lines removed

Detta kan inträffa när du öppnar en sida som omdirigeras att öppna en annan sida som i sin tur är omdirigerad att öppna ursprungssidan.
Added 4 March 2006''-]

  • Fine, thanks,

I can confirm the above-reported error in Safari... not only does it generate a confusing error message, but it sends the message multiple times. It appears to be due to the form not specifying method='post' ... unlike other browsers, Safari seems to default to method='get' when no method is specified. If you change line 27 to

 SDV($MailFormFmt,"<form action='\$PageUrl' method='post'>

the problem is solved.

Ben Stallings November 02, 2006, at 02:57 PM

Talk page for the EMailForm recipe (users?).