Clan Adverts

Custom PHPNuke Scripts

 

Send Email Using PHP

Description: Just a short tutorial to give you an idea on how to send email using php
Version: 1.0
Added on: 24 February 2007
Author: unkown
Difficulty Level: Very Easy
Views: 259
Rating: 9.5 (2 Votes)
Detailed Profile

Code:
<?

if($_POST[submit]){ // Checks to see if the form has been submitted or not

$to = "YOUREMAIL@YOURSITE.COM"; // Your Email Address

$subject = $_POST['subject']; // Gets the fields from the form

$message = $_POST['message'];

if($subject==NULL|$message==NULL) { // Checks to see if the fields are left blank and if so it display the message

die("Sorry, but one of the fields was left blank. Please Return To The Form");

}

$mailsend = mail($to,$subject,$message); // Puts the information into order and then sends it

{

header("Location: ?message=Thank you"); // Redirects the page back to contact.php and then displays a message

}

}

?><form method="POST" action="submit.php">

<p><label for="fp2">Subject:<br>

</label>

<input type="text" name="subject" size="20" id="fp2"><br>

<label for="fp1">Message:<br>

</label>

<textarea rows="6" name="message" cols="16" id="fp1"></textarea><br>

<input type="submit" value="Submit" name="submit"><input type="reset" value="Reset" name="B2"></p>

</form>

<? echo $message ?>