Article About -
| How to send an E-Mail with Php by Giovanni Ceglia - giovanniceglia@xungame.com (it was shown 4057 times) |
In this simple article and source sample, it will be show how to create a form to send e-mails in Php server side language, this example is valid both for Php on Linux and both on Windows.
The first task it to create the module, and for this job we could find more solutions but we will implement the script using 2 different pages, I suggest the use of two different pages to divide contents and scripting.
Files where we will add the code:
-- modulo.php --
< form method="Post" action="scripts/mail.php" >
Mittente: < input type="text" name="FROM" >< br >
Titolo: < input type="text" name="SUBJECT" >< br >
Corpo del messaggio: < br >
< textarea cols="64" rows="4" name="BODY" >< /textarea >< br >
< br >
< input type="submit" value="send now" >
< /form >
----------------
-- scripts/mail.php --
< ?
$from=$HTTP_POST_VARS['FROM'];
$destination="webmaster@website.ext";
$subject=$HTTP_POST_VARS['SUBJECT'];
$message=$HTTP_POST_VARS['BODY'];
mail($destination,$subject,$message,"From:".$from);
header("location: ../modulo.php");
? >
----------------------
Important Site links:
http://www.giovanniceglia.com