Networking, Programming and Graphics Tutorials

Use PHP to send email from web applications [1/3]

Type: Code Networking, Programming and Graphics Tutorials
Use PHP to send email from web applications
Level: Beginner Networking, Programming and Graphics Tutorials 
Use PHP to send email from web applications
Date: 2007-Mar-12
Use PHP to send email from web applications
Visited: 914 times
Use PHP to send email from web applications
Rating: Use PHP to send email from web applications
Use PHP to send email from web applications
Author: Ivory Morhuld

You have seen html form whose send e-mails based on content entered in the form and now you want the same form on your web site. Ok, no problem.

Let's start with html file which containing the form where user writes his message and send by pressing the [Send] button.

Please note that we have one input field named "send" with value parameter set to 1. This field we will use later when sending form to server to check that the form is truly sent.

Also in our example we using POST method for sending the data and for action of form we use the same file with form - $_SERVER['PHP_SELF']

<html>
<head>
<title>Sending e-mails with PHP mail() function</title>
</head>
<body>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    <input type="text" name="from_name">
    <input type="text" name="from_email">
    <textarea name="message"></text>
    <input type="hidden" name="Send" value="1">
    <input type="submit" value="Send">
</form>
</body>
</html>
You have to know that when in your php.ini register_globals = Off and you receiving data with POST method you have to use $_POST['var_name'] instead $var_name!

<?php
$send
=$_POST['send'];
$from_name=$_POST['from_name'];
$from_email=$_POST['from_email'];
$message=$_POST['message'];
?>
Networking, Programming and Graphics Tutorials - Use PHP to send email from web applications [1/3] - Networking, Programming and Graphics Tutorials

Need a specific tutorial? Do not hesitate and submit a request!
Related Tags: send email on web php  "PHP how to send email"  "send email from web"  how to send email  how to send email php  php email send value in message  send content value+php email function  how to restore applications on xp  applications function overloading c++  nero burning cd applications  Applications of exception handling c++  applications of function overloading(pdf)  Applications of Function overloading in C++  applications on operator functions in c++  remote applications outlook express  "filters" 'applications" "photoshop"'noise'  applications that need administrator accounts in windows xp  changing Windows ports for running applications  how to change the port number of Applications in windows 2003  email troubleshooting