REQUEST: exact script.

Status
Not open for further replies.

Bryon

I Fix Things
Messages
8,149
Reaction score
101
Points
48
PHP:
<?php
   if ($_POST['submit']) {
      $header = 'From: '. $_POST['from'];
      mail($_POST['to'], $_POST['subject'], $_POST['body'], $header);
      echo 'Email sent.';
   }
?>

 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
  <div>
   To: <input type="text" name="to" value="">
   Subject: <input type="text" name="subject" value="" />
   Body: <textarea name="body"></textarea>
   From: <input type="text" name="from" value="">
   <input type="submit" name="submit" value="Send Email">
  </div>
 </form>

There you go. No user input validation though, which isn't necessarily a good thing.. but whatever.

Your 'Readme': http://us2.php.net/manual/en/function.mail.php
 
Last edited:

Derek

Community Support Force
Community Support
Messages
12,882
Reaction score
186
Points
63
What is the user input validation?? Can you include it? I will test this is good for about 1500 points..\\

www.collide.elementfx.com/testing.php

It doesnt work maybe you can fix it xD
 
Last edited:

Bryon

I Fix Things
Messages
8,149
Reaction score
101
Points
48
It works fine, I just tested it.

What I meant by 'validating user input' was like.. Verifying what a user entered (Aka user input) is correct before using it directly in the script.

Also, I don't need any points.
 
Last edited:

Derek

Community Support Force
Community Support
Messages
12,882
Reaction score
186
Points
63
=) works thanks! Also can you add that in and the verfication and make it so i can input the senders name Thanks!

Hmm also is there a thing where i can log what gets sent by this thing..

Wait i dont want the verfiying i twant the thing hwere you enter like 564654 or something that verfication


=) http://collide.elementfx.com/dmailer.php
 
Last edited:

Bryon

I Fix Things
Messages
8,149
Reaction score
101
Points
48
Pay someone else the points to do it, what you're asking for wouldn't be difficult at all, but I'm busy with x10 stuff. :)
 
Last edited:

Derek

Community Support Force
Community Support
Messages
12,882
Reaction score
186
Points
63
Aww man... I really need it and your the best =)

Nvm i did the image verfication myself
 
Last edited:

daman371

New Member
Messages
130
Reaction score
0
Points
0
I'm not sure if this is still needed but I added the validation.

Code:
<?php
   if ($_POST['submit'])
   {
		$header = 'From: '. $_POST['from'];
		$subject = $_POST['subject'];
		$body = $_POST['body'];
		$to = $_POST['to'];
		if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $to))
		{
			echo "The recipient's e-mail was invalid.";
		}
		else if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $_POST['from']))
		{
			echo "Your e-mail was invalid.";
		}
		else
		{
			if ($body == "")
			{
				echo "Body left blank.";
			}
			else if ($subject == "")
			{
				echo "Subject left blank.";
			}
			else
			{
				mail($to, $subject, $body, $header);
				echo 'Email sent.';
			}
		}
   }
?>

 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
  <div>
   To: <input type="text" name="to" value="">
   Subject: <input type="text" name="subject" value="" />
   Body: <textarea name="body"></textarea>
   From: <input type="text" name="from" value="">
   <input type="submit" name="submit" value="Send Email">
  </div>
 </form>
 

Derek

Community Support Force
Community Support
Messages
12,882
Reaction score
186
Points
63
Hmm can you also add the captcha?
 
Status
Not open for further replies.
Top