Send an email

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
arash6485
Forum Newbie
Posts: 2
Joined: Wed Oct 13, 2010 5:18 am

Send an email

Post by arash6485 »

I have a code for sending an email which is supported by PHP4. I need something which works like that in a PHP5 language. Any help?

Thanks
adil
Forum Newbie
Posts: 6
Joined: Wed Oct 13, 2010 3:46 am

Re: Send an email

Post by adil »

<html>
<body>

<?php
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
{
//send email
$email = $_REQUEST['email'] ;
$subject = $_REQUEST['subject'] ;
$message = $_REQUEST['message'] ;
mail( "someone@example.com", "Subject: $subject",
$message, "From: $email" );
echo "Thank you for using our mail form";
}
else
//if "email" is not filled out, display the form
{
echo "<form method='post' action='mailform.php'>
Email: <input name='email' type='text' /><br />
Subject: <input name='subject' type='text' /><br />
Message:<br />
<textarea name='message' rows='15' cols='40'>
</textarea><br />
<input type='submit' />
</form>";
}
?>

</body>
</html>
arash6485
Forum Newbie
Posts: 2
Joined: Wed Oct 13, 2010 5:18 am

Re: Send an email

Post by arash6485 »

tnx for your reply but it is like the one I have which is in PHP4. are you sure it works with PHP5 supported server as well, cause it doesnt work for my website after the host provider changed server version to a new version which is windows server 2008
Post Reply