This is a discussion on "PHP Email" within the PHP Forum section. This forum, and the thread "PHP Email are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
PHP Email
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
PHP Email
I want to make a php script to send an e-mail.
I've looked into this and found a few websites to help with that script. My problem I want my php script to run from an e-mail. The email I send has an HTML form to fill out, I want a script from that to e-mail me. I do have a website that I can host that script on. For the script will I just put a URL for the script? like
Thanks |
|
|
|
|||
|
Re: PHP Email
Heres Code For a Basic Contact Form With Your Email,Subject,Description
Contact.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <form method="POST" action="contact.php"> Fields marked (*) are required <p>Your Email :* <br> <input type="text" name="EmailFrom"> <p>Subject: <br> <input type="text" name="Subject"> <p>Description:<br> <textarea name="Description"></textarea> <p><input type="submit" name="submit" value="Submit"> </form> <p> </body> </html> Contact.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <?php $EmailFrom = Trim(stripslashes($_POST['EmailFrom'])); $EmailTo = "youremail@domain.com"; $Subject = Trim(stripslashes($_POST['Subject'])); $Description = Trim(stripslashes($_POST['Description'])); $validationOK=true; if (Trim($EmailFrom)=="") $validationOK=false; if (!$validationOK) { print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; exit; } $Body = ""; $Body .= "Description: "; $Body .= $Description; $Body .= "\n"; $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=ok.htm\">"; } else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; } ?> </body> </html> if you have any questions just ask me by replying to this post Sam |
|
|||
|
Re: PHP Email
Will this script work in an e-mail?
Last edited by Sabin_33; Dec 21st, 2006 at 22:38. Reason: 'the an' aren't suppose to go together |
|
|||
|
Re: PHP Email
I think you are confusing yourself.
The form is the method by which you enter the required data. The php script then processes that form data and generates the email which it sends wherever you tell it. |
|
|||
|
Re: PHP Email
ukgeoff: I don't think I am confused.
The form is going to be on an e-mail which is going to re-submit an e-mail. My Orignal question : Quote:
|
|
|||
|
Re: PHP Email
aah yes I understand you this secure yes well pretty secure but why does an email form need to secure anyway? thats what I do in all the contact forms I've done
|
|
|||
|
Re: PHP Email
OK great Thanks
|
![]() |
| Tags |
| php email |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| jasonjkd | Web Page Design | 9 | Nov 12th, 2007 22:36 | |
| PHP email form not sending email | Kurt | PHP Forum | 1 | Oct 12th, 2007 04:26 |
| Asp And Email | jimmy3shoes | Classic ASP | 2 | Aug 1st, 2007 09:39 |
| Form submits to email via php, but email is blank!!?? | DH1234 | PHP Forum | 2 | Jun 18th, 2007 10:42 |