Send mail using PHP
Script last updated on December 4, 2006 2:25pm by !nucleo.
Pretty self explanatory. Mail() takes four arguments; Recipient, Subject, Body, Header info. For header info I just use from. The syntax is HEADER-ITEM: value. And in the case of the from header item you can put the persons name first and the email second in angle brackets.
<?
if (!empty($_POST)) {
$to = "nucleocide@gmail.com";
$subject = htmlentities($_POST['about']);
$body = htmlentities($_POST['comment']);
$from = htmlentities($_POST['email']);
if (mail($to, $subject, $body, "From: $name <$from>")) {
echo("<p>Message has been sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}
} else {
?>
<p>If you would like to ask us any questions,
request a quote, or send us any other message
this is the place to do so. Please allow one to two
business days for a response.</p>
<br />
<form action="?s=contact" method="post">
<input name="name" value="name" class="full" /><br />
<input name="email" value="email" class="full" /><br />
<select name="about" class="full">
<option value="Question">Question</option>
<option value="Quote Request" />Quote Request</option>
<option value="Other" />Other</option>
</select>
<textarea id="text" name="comment" class="full">Message</textarea>
<input type="submit" value="Send" />
</form>
<? } ?>




