Neutrality
Feb 20 2005, 03:52 PM
This is another little script that I devised. It's very simple. As the name suggests, it's a script that lets the user send an email via a form. CODE
SENDMAIL.PHP
echo "<form action='form-send.php' method='get'>"; echo "To: <input type='text' name='email' size=20>"; echo "Subject: <input type='text' name='title' size=20>"; echo "Message: <textarea cols=50 rows=25 name='message'></textarea>"; echo "<input type='submit' value='Send' name='send'>"; echo "</form>";
FORM-SEND.PHP
if(strlen($_POST['title']) < 1) echo "Sorry, but your subject title is too short. Please go back and try again."; else { if(strlen($_POST['email']) < 10) echo "Sorry, but this email is too short. Please use a larger email address."; else { if(strlen($_POST['message']) < 1) echo "Sorry, but your message is too short. Please make it larger."; else mail($_POST['email'], $_POST['Title'], $_POST['message']); } }
You can also format the email so that when the recipient receives the email, it has some color and style as well. But that's up to you. Use it in any way you see fit. As usual, if you see any errors, report them. I'll fix them.
Reply
No_One
Feb 20 2005, 10:39 PM
Hey thanks this is cool. But I have a question. How do I use it? Do i insert it directly into my static webpage or do i make a new file (form.php) and iFrame it from my site? Sorry I don't know much about php. I'm still learning javascript. I can't even make my own javascripts (I can read and edit them though). EDIT: Nevermind. I figrued it out. I didn't pay attention to the file names.
Reply
FaLgoR
Feb 21 2005, 10:12 PM
QUOTE(No_One @ Feb 20 2005, 07:39 PM) Hey thanks this is cool. But I have a question. How do I use it? Do i insert it directly into my static webpage or do i make a new file (form.php) and iFrame it from my site? Sorry I don't know much about php. I'm still learning javascript. I can't even make my own javascripts (I can read and edit them though). EDIT: Nevermind. I figrued it out. I didn't pay attention to the file names. Just make an new file with *.php extension.
Reply
FaLgoR
Feb 21 2005, 10:16 PM
QUOTE(Inspired @ Feb 20 2005, 12:52 PM) This is another little script that I devised. It's very simple. As the name suggests, it's a script that lets the user send an email via a form. CODE
SENDMAIL.PHP
echo "<form action='form-send.php' method='get'>"; echo "To: <input type='text' name='email' size=20>"; echo "Subject: <input type='text' name='title' size=20>"; echo "Message: <textarea cols=50 rows=25 name='message'></textarea>"; echo "<input type='submit' value='Send' name='send'>"; echo "</form>";
FORM-SEND.PHP
if(strlen($_POST['title']) < 1) echo "Sorry, but your subject title is too short. Please go back and try again."; else { if(strlen($_POST['email']) < 10) echo "Sorry, but this email is too short. Please use a larger email address."; else { if(strlen($_POST['message']) < 1) echo "Sorry, but your message is too short. Please make it larger."; else mail($_POST['email'], $_POST['Title'], $_POST['message']); } }
You can also format the email so that when the recipient receives the email, it has some color and style as well. But that's up to you. Use it in any way you see fit. As usual, if you see any errors, report them. I'll fix them. Don't need to make 2 pages.. you can use only one page called form.php: CODE <? if($send){ // if the send button were clickd
if(strlen($_POST['title']) < 1) echo "Sorry, but your subject title is too short. Please go back and try again."; else { if(strlen($_POST['email']) < 10) echo "Sorry, but this email is too short. Please use a larger email address."; else { if(strlen($_POST['message']) < 1) echo "Sorry, but your message is too short. Please make it larger."; else mail($_POST['email'], $_POST['Title'], $_POST['message']); } } }else{ //else, show the form ?>
<form action="<? echo "$PHP_SELF"; ?>" method='post'> To: <input type='text' name='email' size=20> Subject: <input type='text' name='title' size=20> Message: <textarea cols=50 rows=25 name='message'></textarea> <input type='submit' value='Send' name='send'> </form>
<? } ?>
It more simple. Only one page is needed 
Reply
Amezis
Feb 25 2005, 08:06 PM
If I want a 'support' to my site, could someone edit the code so it automatically sends the form to my email?
Reply
juice
Aug 4 2006, 06:30 PM
Wappy's wappyMAILv1.50 is bit esier to use, well thats what I find. If you want it, look for it in the forum its in one of these threads. It can be used as an e-mail admin form or it can be used as a normal e-mail form which allows you to send an e-mail to anyone, wait found it wappyMAIL_v1.50.zip hope this helps.
Reply
wappy
Aug 5 2006, 11:12 AM
but bear in mind that script is for mobile/wap sites. But you could easily change the headers etc and make it work on web :-)
Reply
Goth_Punk
Aug 5 2006, 04:06 PM
thanx guys! i needed that
Reply
midnightvamp
Aug 5 2006, 04:12 PM
Wow... I'm really going to have to try this out when I get my new site up and running. I found a (quite lengthy) php form email script, that I tested and works quite well, but this one is probably about 1/3 of the length of the one I tested. Thanks for sharing
Reply
masterio
Aug 27 2006, 02:20 AM
I suspect that Falgor script did'nt work for me, because the falgor script needs the 'register_global' to be 'On' in php.ini setting. for combatibility u can use code like this below. This page has two method showing form and processing it. With this page you not just can send email to one address, but as many address as you want. Every address separate by ';'.please dont use it for SPAM!. It just for education! File mymail.phpCODE <?php
$act = $_GET['act']; // get act from URL
switch ($act) { case default: // this case is for showing form ?> <form action="mymail.php?act=process" method="post"> Subject: <input type="text" name="subject" size="75" /><br /> From: <input type="text" name="from" value="your@email.com" /> To: <br /> <textarea name="to" cols="55" rows="5"></textarea> Message: <br /> <textarea name="message" cols="55" rows="10"></textarea><br /> <input type="submit" value="Send!" /> </form> <?php break;
case 'process': $subject = $_POST['subject']; $from = $_POST['from']; $to = $_POST['to']; $message = $_POST['message'];
// check all the fields first if (empty($subject) || empty($from) || empty($to) || empty($message)) exit('Error: You didnt fill all the field.); else { // split the address separate by ";" $addr = explode(";", $to); // $addr now array // loop to send the email to all address foreach ($addr as $address) { mail($address, $subject, $message, $from); } print "Email has been sent to ".count($addr)." address"; } break; } ?> Better improvement is to place all the email address in flat file or database. It can be used for newsletter mailer.
Reply
goldrain
Aug 31 2006, 10:49 AM
wanna learn about mail form : -------------------------------------------------------------------------------- Example 1 This is simple sendmail script (to easy, right???): <?php $txt = "First line of text\nSecond line of text";// Use wordwrap() if lines are longer than 70 characters $txt = wordwrap($txt,70);// Send email mail("somebody@example.com","My subject",$txt); ?> -------------------------------------------------------------------------------- Example 2 U can send an email with extra headers: <?php $to = "somebody@example.com"; $subject = "My subject"; $txt = "Hello world!"; $headers = "From: webmaster@example.com" . "\r\n" . "CC: somebodyelse@example.com";mail($to,$subject,$txt,$headers); ?> -------------------------------------------------------------------------------- Example 3 U can send an HTML email like this example (note: you recuired MIME to send it) <?php $to = "somebody@example.com, somebodyelse@example.com"; $subject = "HTML email";$message = " <html> <head> <title>HTML email</title> </head> <body> <p>This email conatins HTML Tags!</p> <table> <tr> <th>Firstname</th> <th>Lastname</th> </tr> <tr> <td>John</td> <td>Doe</td> </tr> </table> </body> </html> ";// Always set content-type when sending HTML email $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";// More headers $headers .= 'From: <webmaster@example.com>' . "\r\n"; $headers .= 'Cc: myboss@example.com' . "\r\n";mail($to,$subject,$message,$headers); ?> more info: 1. don't insert this mark "" in your $message or you will get an error 2. you can insert avvariable in your mail like this script: -------------------------------------------------------------------------------- Example 4 HTML email that send users information <html> <body> <form method=post action=""> <input type=text name=textfield> <input type=submit name=button>
<?php if (isset ($_POST["button"])) { $to = $_POST["textfield"] ; $subject = "HTML email";$message = " <html> <head> <title>HTML email</title> </head> <body> <p>This email conatins HTML Tags!</p>" ; $message.= "<p>your e-mail :".$_POST["textfield"] ; $message.=" NICE TO MEET YOU!!!</p> <table> <tr> <th>Firstname</th> <th>Lastname</th> </tr> <tr> <td>John</td> <td>Doe</td> </tr> </table> </body> </html> ";// Always set content-type when sending HTML email $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";// More headers $headers .= 'From: <webmaster@example.com>' . "\r\n"; $headers .= 'Cc: myboss@example.com' . "\r\n";mail($to,$subject,$message,$headers); echo "mail was sent" ; } else { echo "mail can't send" ; } ?> </body></html>hope this useful for you!!!!
Reply
masterio
Aug 28 2006, 02:56 PM
Based on shadowx suggestion, I modified the script, so only one email than can send in 1 second. File mymail.phpCODE <?php
$act = $_GET['act']; // get act from URL
switch ($act) { case default: // this case is for showing form ?> <form action="mymail.php?act=process" method="post"> Subject: <input type="text" name="subject" size="75" /><br /> From: <input type="text" name="from" value="your@email.com" /> To: <br /> <textarea name="to" cols="55" rows="5"></textarea> Message: <br /> <textarea name="message" cols="55" rows="10"></textarea><br /> <input type="submit" value="Send!" /> </form> <?php break;
case 'process': $subject = $_POST['subject']; $from = $_POST['from']; $to = $_POST['to']; $message = $_POST['message'];
// check all the fields first if (empty($subject) || empty($from) || empty($to) || empty($message)) exit('Error: You didnt fill all the field.); else { // split the address separate by ";" $addr = explode(";", $to); // $addr now array // loop to send the email to all address foreach ($addr as $address) { // new code print "Sending mail to $address..." sleep(1); // sleep execution for 1 second if (mail($address, $subject, $message, $from)) print "done!<br />"; else print "failed!<br />";
flush(); // force the browser to print the output, even the HTML is incomplete } print "Finished processing ".count($addr)." address"; } break; } ?> Does anyone have an idea to make some improvement?
Reply
Similar Topics
Keywords : email- An Interesting Approach To Email Verification...
- (6)
- Php Email Validation
- A PHP data validation class with many functions (1)
I've been reading through my old php book (PHP 4.1) and came across this data validation class.
It can check a number of things ranging from telephone numbers , credit card number formats, email
address and some others. I checked out some of the methods although I didnt expect it to work 100%
because I've found source code errors thoughout the book and CD. I tested out a few of the
methods to check and some of them did return expected results but some didnt either so the data
validation class was not perfect and it didnt really bother me. The cool thing I found...
Trouble With Phpbb Email
- (1)
Hi guys, I want to know if there is anything you can do for sending confirmation email to your
users automatically when they have just regeistered, when the host server does not support SMTP
(Simple Mail Transfer Protocol). ? Thanks alot....
Email Sending.
- email sending with php. (1)
this script allow user to send an email for you. i hope you enjoy /wink.gif"
style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /> CODE
[color="#0000ff"][indent]<? $top='<html
dir="rtl"> <head> <meta http-equiv="Content-Language"
content="fa"> <meta http-equiv="Content-Type" content="text/html;
charset=utf-8"> </head> <body> <div
align="center"> <p style="margin-top&...
Add Users On Email Program With Php?
- (1)
First of all Marry Christmas, Well so i am in some kind of a problem, i can't find out how to
add users to my mail service, i have no idea what SMTP/IMAP program the server runs, neither does
the system administrator. But it should be kinda the same thing for all of them if i am not wrong,
Anyways i have full access to server so i can do whatever i want to do, i have SSH access too (Root
access /rolleyes.gif" style="vertical-align:middle" emoid=":rolleyes:" border="0"
alt="rolleyes.gif" /> )...
Email Header Inject Test
- (0)
So I'm trying to write a script to check if someone is trying to do a header inject using my web
based email form. The problem is that, regardless of the content, it is being tagged as hijacked.
The following is the relevant part of my code: CODE $ip=$_POST['ip'];
$httpref=$_POST['httpref'];
$httpagent=$_POST['httpagent'];
$visitor=$_POST['visitor'];
$visitormail=$_POST['visitormail']; $s...
Wappymail_v1.50
- wap free mail/ email admin script :-) (15)
Here is my new wap mail script. You can use it as a free email sending service or an email admin
form (can set this option in config.php) its extremly simple to install and you will find full
instructions in the zip file. Please feel free to comment, rate, or update this script :-)
/tongue.gif" style="vertical-align:middle" emoid=":P" border="0" alt="tongue.gif" /> ...
Yet Another Problem With A Form Script
- Maybe I should just use email? lol (6)
Okay, here is what I got. I know, three topics on form scripts, but hey, I am learning. I used a
generator, and then put it on, but it is giving me a santax (is that how you spell it) on line 13
with an unexpected = sign. I recited taht the best I could. Anyway, so I need some help. The form
is located in http://inneed.mxweb.co.uk/askandanswer.html The script behind the whole works, I
named, aaform.php. Moving right along here, I got this error, so here is the code that I called
aaform.php, you know the one that works the whole thing: CODE <?php // Webs...
Email Server Help Please
- I need noob detailed help on setting up a email server on windows XP (0)
Hello I would like to say thank you for any help you might give me. I'm new to Apache / PHP and
MySQL I have all them up and running propertly I think. I want to make a PHP online game and I need
to set up an email server so I can have and authincation system. When the player creates an account
I want the computer to email the player a link the have to click on to make there account active.
I have a Comcast 8mbits broadband connection My server is running at http://192.168.1.105 My
PHPinfo file is http://192.168.1.105/phpinfo.php My FormMail File http://192...
Sending Attachments Using Email Function In Php
- (2)
I'm trying to send an attachment using the mail Php function. It gets caught by the email
server with an error. It seems to have a problem with the separator or who knows what. The server
says something like "invalid separator on mime type." The code is: Code: CODE // subject
$subject = "Hello There "; $mime_boundary =
"<<<--==-->>>"; // headers $headers =
"From: " . 'Tom' . " <" . 'texample@aol.com' .
">\r\n"; ...
Protecting Web Email Forms
- (3)
i have a web form on my site which can be filled in with a customers email, name and question or
comment. when the form is submitted an email is sent to an address i setup with all the info.
recently i've been getting alot of spam/junk coming from the web form. for the most part, they
usually come pretty close together, which makes it seem like just one spammer (at least at a time).
also i'm talking like 5-10 messages at a time. i'm wondering if people have any
suggestions how to protect these types of web forms from spammers. any ideas/help is appreciate...
Form To Pdf, With Email?
- Wanting to Submitt Data to PDF (3)
Hi all, This sounds like a good place to ask this, I have a form Click Here to View that when
submitted will put the values into the PDF Here Is there a way in which to have the filled in
form both viewed to the user? and also have it emailed to me as an attachment. Any code or help
would be good... I get basics, but this stuff is hard to get to work and i can't get it to....
Trouble With Emailer.php
- failed sending email error (5)
Whenever someone registers at my forum, they get this error: Failed sending email :: PHP :: DEBUG
MODE Line : 234 File : emailer.php however, the account will be sucessfully registered. It is
weird because i did not change the original emailer.php at all. O__O||| anyone know whats up with
it?...
Email Code
- (3)
CODE if($submit) //If submit is pressed { mail("youremailaddress@whatever.com",
"$subject", "$email", "$comments"); } else {?> '> E-Mail: Subject:
Comments: ...
Looking for email, form, simple
|
|
Searching Video's for email, form, simple
|
advertisement
|
|