Active
Project:
form_mail
Version:
4.6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Reporter:
Created:
16 Jan 2004 at 13:18 UTC
Updated:
20 Apr 2006 at 14:38 UTC
Hi.
Is there any site where I can see the form_mail module in action?
Also I'd like to have a sample form to use as a base.
I'm planning some arbitrary forms including a tell a freind so I'd like to be able to include the reffering page as a hidden field in the form.
Comments
Comment #1
Tarlbot commentedComment about form_mail
sample: http://www.ericscouten.com/feedback
Comment #2
(not verified) commentedComment #3
boris mann commentedI think this might be more useful as a code example. Easiest way to do this is create a static page with content set to PHP and this included in it. Of course, a block or any other place you can input PHP in Drupal would work as well.
Look at the form functions in
common.incfor more details.Comment #4
(not verified) commentedI added this code to a static page, saved as php, and got an error message. This is with a fresh drupal 4.4 installation with form_mail 4.4 installed. Can anybody help?
Parse error: parse error in /home/palchemy/public_html/modules/page.module(129) : eval()'d code on line 1
Comment #5
(not verified) commentedtry it without "
" and ""Like this
$form .= form_textfield("Subject", "subject", "", 60, 70);
$form .= form_textfield("Name", "from_name", "", 60, 128);
$form .= form_textfield("Email", "from_email", "", 60, 128, "Please fill this out if you would like a response by email");
$form .= form_textarea("Message", "body", "", 60, 15);
$form .= form_submit("Send email");
echo form($form, "post", "form_mail");
Comment #6
wimvos commentedSame error, although i have deleted the quotes, does not work.
Comment #7
cherylchase commentedThis works for me (drupal 4.4.1). Note that the static page content should just contain only:
[quote]
$form .= form_textfield("Subject", "subject", "", 60, 70);
$form .= form_textfield("Name", "from_name", "", 60, 128);
$form .= form_textfield("Email", "from_email", "", 60, 128, "Please fill this out if you would like a response by email");
$form .= form_textarea("Message", "body", "", 60, 15);
$form .= form_submit("Send email");
echo form($form, "post", "form_mail");
[/quote]
Comment #8
kc commentedit works but where does it send the email and how can one specify another page for the user to be forwarded to after successfull sending?
Comment #9
trailerparkopera commentedHere's what I've worked out for my own needs. This form template hides the "EmailTo" field (that overrides the form_mail default) and "EmailSubject" field in the form, but posts a default value for those fields. I use it to subscribe people to an email list I have on a separate server, running a different system.
[quote]
$form .= form_hidden("to", "(INSERT TO: ADDRESS HERE");
$form .= form_hidden("subject", "(INSERT SUBJECT: ADDRESS HERE")");
$form .= form_textfield("Name", "from_name", "", 60, 128);
$form .= form_textfield("Email", "from_email", "", 60, 128, "(CUSTOMIZE MESSAGE AT BOTTOM OF FORM HERE)");
$form .= form_hidden("Message", "body", "", 60, 15);
$form .= form_submit("Sign me up!");
echo form($form, "post", "?q=form_mail");
[/quote]
Comment #10
(not verified) commentedi included the module form_mail and inserted the code example from above
the form elements are drawn well, but when sending the form it just tries to jump to the location form_mail not sending the form.
How do I connect my form with the form_mail module?
thanks florian
Comment #11
lgm@drupal.org commentedI used trailerparkopera's example "submitted by trailerparkopera on June 29, 2004".
the only change I needed was from :
to this :
Comment #12
jcosters commentedI think you should use
echo form($form, "post", url("form_mail"));url() constructs a clean URL or a normal (?q=...) URL, depending on your setting in the administration section. That way your code is independant of either type of URL.
Comment #13
seanrI know you can put multiple address in the two field separated by commas, but I'm doing an invite form and would rather use separate fields for each address (to make it more obvious to the user). How would I go about this? Here's the code I'm using right now:
Can you do something like this:
Comment #14
seanr(fixed title - had accidentally changed it)
Comment #15
Steven commented$form .= form_hidden("to", "(INSERT TO: ADDRESS HERE");
$form .= form_hidden("subject", "(INSERT SUBJECT: ADDRESS HERE")");
This should be avoided. It allows anyone to send email using your site and a custom form. It is best to put the to/subject on the server side, and fill it in after the form is submitted. You should also look into throttling, to prevent mass emailing/spamming.
Dries' upcoming Contact.module has such a generic mechanism.
Comment #16
wheelweb commentedHi,
I want to create a form where I can send additional information via email such as Krankenversicherung, Gender etc. This information should be sent in the subject of the email.
How can I do this?
I use this code now:
Thanks a lot!
Comment #17
lvadillo commentedI'm working with the module and knowing "0" about php is not an easy task. The module looks simple and works fine if at the end I use:
echo form($form, "post", "form_mail"); as shown in the samples above.
I need some help on the following:
I have already set up a "Thank You" page for the form to go when pressing the "send" buttom, so I need in the mentioned line to substitute "form_mail" with "node/xxx", but that doesn't work as "form_mail" is the one that actually sends the email.
1) Is there a way to put some php coding in "node/xxx" so to be able to send the email and avoid the "form_mail" page display?
(I've tried aliasing the "node/xxx" as "form_mail" but that doesn't work)
As secondary wishes:
2) If in the form I ask for the user to put his/her email in one of the variables, is there a way to pass it so that the email is sent to me and to him/her? (a confirmation email)
3) Is there a way to add the YYY variable in the email (form) that equals the sender IP? (in case there is abuse I could know from where it comes).
Thank you.
Comment #18
boris mann commentedUse one of forms.module, survey.module, webforms.module, contact.module, feedback.module
Comment #19
gauz commentedHi all, I need sample of this module for multiple choice, checkbox, radio and all type of form if posible.
Comment #20
boris mann commentedUse the forms.module instead, and inspect the code to see how to call the PHP.
If you would like to create forms directly, you can use either the survey module or the webforms module.
Comment #21
Leeteq commentedStep by step procedure on making a mail form after the form_mail module has been installed and enabled: (version 4.6.x)
1. Make a new Page, book page, or whatever content type you want.
2. Set the desired title and categories.
3. Select to use PHP code, not HTML. (perhaps only Administrators can do this, depending on the actual permissions on that portal)
3. Click in the BODY text field
4. If you are using a WYSIWYG tool that lets you format text in the body text field easily, click on a button called "Toggle HTML source" or something similar to that.
5. Paste the following: (IMPORTANT: NO trailing spaces..!)
6. Submit your page, do not toggle back to HTML in the body text.
Now your form should be displayed.
Comment #22
Leeteq commentedBy the way, you have to configure the module after enabling it, of course:
- enter the receiving mail address in Administer/form mail, and
- give access to the form_mail module in Administer/Access Control.
Comment #23
snackmaster commentedAny way to validate fields, especially email so as to help prevent people from inputting an invalid address by mistake, therefore I never recieve the form and the sender thinks I'm ignoring them?
Comment #24
zepernick commentedI went through the include file and pulled out all of the form functions, in case anyone needs them.
Comment #25
ryanrain commentedi followed the instructions in comment #21 to a tee, but when i click submit i get a Not Found error. i can't seem to get clean URL's to work, so that may be the problem, it can't find me.com/form_mail.
can anyone suggest how to work around this?
by the way, this function is something that mambo does much better. it's crazy that i'm having to screw with php code just to get a contact me form happening.
thanks in advance,
-ryan
Comment #26
fuzzie commentedCan you help me with a form here:
http://deibler-insurance.com/node/34
Comment #27
nickels commentedI'm using 4.6 - upgrading to 4.7 is not an option.
I want multiple contact forms, each with different recipient emails. Everyone should be able to use these, not just authenticated users. Is there anyway to hide the recipient email address besides this:
Comment #28
dan_aka_jack commentedHi there,
I've just had a go at re-writing this module for use with Drupal 4.7 if you're interested:
http://drupal.org/node/53543
Comment #29
sodani commentedMy form submits, but I never get the e-mail. Does anyone know what might be going on? I inserted my e-mail address in settings>form_mail
Comment #30
elv commentedI'd like to set up a file upload in a form, but I don't get it. The only help I found was this line "* For assistance with handling the uploaded file correctly, see the API
* provided by file.inc" in zepernick comment.
Hint anynone ? Thanks !
Comment #31
elv commented(sorry I changed the title by mistake. Old title is back)
Comment #32
waa commentedUsing the sample php form in this thread, I have set each ofthe fields as required in my form as so:
$form .= form_textfield("Name", "from_name", "", 60, 128, "", "", 1);
Each field name on the form now has a red * next to it signifying that it is indeed a required field, yet I can click "send emai" with all fields empty and form_mail happily shows the "thank you" page and sends off an empty email with the Drupal system's default email as the From: field.
Just in case, I also tried using "1" for the $required value which displayed the red "required" * on the form but results were the same.
Thanks for any help on this.
--
Bill Arlofski
Reverse Polarity
Comment #33
waa commentedOOps, didn't realize that the title of my post would change the top level title. It's back now... Sorry!