PHP Email

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.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Dec 21st, 2006, 17:31
Junior Member
Join Date: May 2006
Location: A Place Far Away
Age: 26
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
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
Code: Select all
<form action="www.mysite.com/scripts/sendmymail.php">
Is this secure?

Thanks
Reply With Quote

  #2 (permalink)  
Old Dec 21st, 2006, 21:12
Up'n'Coming Member
Join Date: Sep 2006
Location: Nottingham
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Ducky Send a message via MSN to Ducky Send a message via Yahoo to Ducky Send a message via Skype™ to Ducky
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
Reply With Quote
  #3 (permalink)  
Old Dec 21st, 2006, 22:05
Junior Member
Join Date: May 2006
Location: A Place Far Away
Age: 26
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
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
Reply With Quote
  #4 (permalink)  
Old Dec 21st, 2006, 22:15
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Skype™ to ukgeoff
Re: PHP Email

Quote:
Originally Posted by Sabin_33 View Post
Will this script work in the an e-mail?
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.
Reply With Quote
  #5 (permalink)  
Old Dec 21st, 2006, 22:36
Junior Member
Join Date: May 2006
Location: A Place Far Away
Age: 26
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
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:
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 Code:
<form action="www.mysite.com/scripts/sendmymail.php">
Is this secure?
Reply With Quote
  #6 (permalink)  
Old Dec 22nd, 2006, 00:05
Up'n'Coming Member
Join Date: Sep 2006
Location: Nottingham
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Ducky Send a message via MSN to Ducky Send a message via Yahoo to Ducky Send a message via Skype™ to Ducky
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
Reply With Quote
  #7 (permalink)  
Old Dec 22nd, 2006, 14:59
Junior Member
Join Date: May 2006
Location: A Place Far Away
Age: 26
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Re: PHP Email

OK great Thanks
Reply With Quote
  #8 (permalink)  
Old Dec 22nd, 2006, 15:28
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Skype™ to ukgeoff
Re: PHP Email

Ok, I'm with you now.
Reply With Quote
Reply

Tags
php email

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
email 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


All times are GMT. The time now is 05:22.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43