# PHP email

**URL:** <https://forum.kirupa.com/t/php-email/10410>\
**Category:** programming\
**Created:** [December 31, 2002, 3:34pm UTC](https://forum.kirupa.com/t/php-email/10410 "2002-12-31T15:34:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JustSara](https://avatars.discourse-cdn.com/v4/letter/j/d26b3c/32.png) [@JustSara](https://forum.kirupa.com/u/JustSara)\
**Post date:** [December 31, 2002, 3:34pm UTC](https://forum.kirupa.com/t/php-email/10410/1 "2002-12-31T15:34:48Z")

</div>

Hello all and Happy Holidays. I have a Flash form set up on my website (and a sniffer thanks to you guys!) but for those few that don’t have Flash I’d like to have a simple submit form using PHP. I went and bought a book about Dreamweaver which is pretty good but I’m confused. Also, my website is hosted on an ISP’s website so I have very limited access to it.

In the book, for PHP email, it has this code:

\<–!  
\<?php  
$email\_to = "me@me.com";  
$email\_subject = "This is the email  
";  
$email\_body = "Body text here!  
";

if (mail (@email\_to, $email\_subject, @email\_body))  
echo “Mail sent.”;  
else echo “Mail failed.”;  
?\>  
–\>

I don’t know what to do with this code. Do I put it on the page with my submit form? Is this supposed to be server side code? Any help will be much appreciated.

JustSara

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 31, 2002, 7:57pm UTC](https://forum.kirupa.com/t/php-email/10410/2 "2002-12-31T19:57:12Z")

</div>

Do a search of the forums (the button on the top-right that says ‘search’). That should help, this question, or questions similar to this have been asked millions of times before…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 31, 2002, 8:18pm UTC](https://forum.kirupa.com/t/php-email/10410/3 "2002-12-31T20:18:19Z")

</div>

this topic was posted 3-4 days ago…  
heres my submisision for a phpmail script…  
If you change the html code with the appropreiate flash code, im sure you can use it for something…

```php

<?php
ob_start("mail");
if ( $_POST['submit'] ) 
{
$reciever = $_POST['reciever'];
$header = $_POST['header'];
$text= $_POST['text'];
mail($reciever,$header,$text);
header($_SERVER['PHP_SELF']);
ob_end_flush("mail");
ob_end_clean("mail");
}
print("<form action='".$_SERVER['PHP_SELF']."' method='post'");
print("reciever:<input type='text' name='reciever'>");
print("header:<input type='text' name='header'>");
print("text:<textarea width=20 height=40 type='text' name='text'></textarea>");
ob_end_flush("mail");
ob_end_clean("mail";

```
