Hi there i own a small service company in AZ and would like to allow users who visit my website to send me email via php (without using the mailto).
I have read a few tutorials online and have tried a simple version but still cannot get it to work.
I have 2 files in my website directory mail.html and mail.php while i am trying to test and figure this thing out.
mail.html include this coding
<html>
<head><title>Mail sender</title></head>
<body>
<form method="post" action="mail.php">
Email: <input name="email" type="text" /><br />
Message:<br />
<textarea name="message" rows="15" cols="40">
</textarea><br />
<input type="submit" />
</form>
</body>
</html>
and mail.php includes this
<?php
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
mail( "rynophiliac@yahoo.com", "Feedback Form Results",
$message, "From: $email" );
header( "Location: http://www.freshyard.com/thankyou.html" );
?>
but when i go to my mail.html and try to send myself an email it says:
The server encountered an unexpected condition which prevented it from fulfilling the request.
The script had an error or it did not produce any output. If there was an error, you should be able to see it in the error log.
I have fatcow which supports php so i really dont know what i am doing wrong??
basic php email on website
Moderator: General Moderators
Re: basic php email on website
hi
Think you'll need to ask your hosts.
this code works fine for me.
Think you'll need to ask your hosts.
this code works fine for me.
Re: basic php email on website
Please, don't use this code on a live server, it's vulnerable to email injection. See
http://www.securephpwiki.com/index.php/Email_Injection
http://www.securephpwiki.com/index.php/Email_Injection